CN107124466A - One kind prevents caching penetrating method and device, computer-readable recording medium - Google Patents
One kind prevents caching penetrating method and device, computer-readable recording medium Download PDFInfo
- Publication number
- CN107124466A CN107124466A CN201710372299.7A CN201710372299A CN107124466A CN 107124466 A CN107124466 A CN 107124466A CN 201710372299 A CN201710372299 A CN 201710372299A CN 107124466 A CN107124466 A CN 107124466A
- Authority
- CN
- China
- Prior art keywords
- caching
- data
- cache size
- server
- size obtained
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/568—Storing data temporarily at an intermediate stage, e.g. caching
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/60—Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
Abstract
Caching penetrating method and device, computer-readable recording medium are prevented the invention discloses one kind, the method comprising the steps of:Client asks cache information, wherein request includes key assignments;Received server-side is asked, and cache size is obtained into server end caching system according to key assignments;Judge whether the cache size obtained is null value;If the cache size obtained is not null value, judge whether the cache size obtained is sky default value;If the cache size obtained is empty default value, empty default value is converted into sky data and returns to client.It is disclosed by the invention to prevent caching penetrating method and device, computer-readable recording medium, stored by newly-increased null value, prevent malicious attack, reduce the influence caused to server-side system database;Using active and standby caching, data are caused to penetrate under prevention key assignments failure conditions;Use the write order of server end caching system, it is ensured that will not be while request server end system database during Refresh Data.
Description
Technical field
The present invention relates to communication technical field, more particularly to one kind prevent caching penetrating method and device, it is computer-readable
Storage medium.
Background technology
General caching system, is all to remove caching query according to key, if there is no corresponding value, after should just going
End system searches (such as database).If the corresponding value of key are certain non-existent, and to the key concurrent request amounts
It is very big, very big pressure will be caused to back-end system.This is just called caching and penetrated.
Restart or largely cache when caching server and concentrate on some time segment fault, so when failure,
Also very big pressure can be brought to back-end system.
Therefore for caching penetration phenomenon, it is desirable to provide a kind of effective ground solution.
The content of the invention
It is a primary object of the present invention to propose that one kind prevents caching penetrating method and device, computer-readable storage medium
Matter, it is intended to solve the problem of caching is penetrated.
To achieve the above object, first aspect of the embodiment of the present invention provides one kind and prevents from caching penetrating method, methods described
Including step:
Client asks cache information, wherein the request bag includes key assignments;
The received server-side request, cache size is obtained according to the key assignments into server end caching system;
Judge whether the cache size obtained is null value;
If the cache size obtained is not null value, judge whether the cache size obtained is sky default value;
If the cache size obtained is empty default value, the empty default value is converted into the return of sky data described to client
End.
Further, the empty default value includes additional character or special character string.
Further, methods described also includes step:
If the cache size obtained is not empty default value, judge whether the cache size obtained is NX default values;
If the cache size obtained is NX default values, data are read from standby caching system according to the key assignments, and will
Read data and return to the client.
Further, methods described also includes step:
If the cache size obtained is not NX default values, the cache size of acquisition is returned into the client.
Further, methods described also includes step:
The write order of the server end caching system is called if the cache size obtained is null value, NX default values are write
In the server end caching system;
Judge whether the NX default values write-in runs succeeded;
If NX default values write-in runs succeeded, data are read from server-side database, if from server end
The data read in database are not null value, then the data read from server-side database are write into the server end delays
In deposit system and standby caching system, and the data read from server-side database are returned into the client.
Further, methods described also includes step:
If the NX default values write-in execution is unsuccessful, data are read from standby caching system, and data will be read
Return to the client.
Further, methods described also includes step:
If the data read from server-side database are null value, empty default value is write into the server end and cached
In system and standby caching system, and empty default value is converted to described in the return of sky data to client.
Further, in the standby caching system effective time of data than data in the server end caching system
Effective time it is long.
In addition, to achieve the above object, the offer of second aspect of the embodiment of the present invention is a kind of to prevent from caching the device penetrated, institute
Stating prevents that caching the device penetrated includes:Memory, processor and it is stored on the memory and can be on the processor
The caching that prevents of operation penetrates program, it is described prevent from realizing when caching the program of penetrating by the computing device above-mentioned prevent from delaying
The step of depositing penetrating method.
Furthermore, to achieve the above object, the third aspect of the embodiment of the present invention provides a kind of computer-readable recording medium, institute
Stating to be stored with computer-readable recording medium prevents caching from penetrating program, described to prevent caching from penetrating program and being executed by processor
Shi Shixian it is above-mentioned prevent caching penetrating method the step of.
One kind provided in an embodiment of the present invention prevents caching penetrating method and device, computer-readable recording medium, passes through
Newly-increased null value storage, prevents malicious attack, reduces the influence caused to server-side system database;Using active and standby caching, in advance
Data are caused to penetrate under anti-key assignments failure conditions;Use the write order of server end caching system, it is ensured that will not during Refresh Data
While request server end system database.
Brief description of the drawings
Fig. 1 is the hardware architecture diagram for the mobile terminal for realizing each embodiment of the invention;
Fig. 2 is a kind of communications network system Organization Chart provided in an embodiment of the present invention;
Fig. 3 prevents caching penetrating method schematic flow sheet for the embodiment of the present invention;
Fig. 4 prevents caching another schematic flow sheet of penetrating method for the embodiment of the present invention;
Fig. 5 prevents the caching another schematic flow sheet of penetrating method for the embodiment of the present invention;
Fig. 6 prevents caching penetrating device structural representation for the embodiment of the present invention.
The realization, functional characteristics and advantage of the object of the invention will be described further referring to the drawings in conjunction with the embodiments.
Embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
In follow-up description, the suffix using such as " module ", " part " or " unit " for representing element is only
Be conducive to the explanation of the present invention, itself there is no a specific meaning.Therefore, " module ", " part " or " unit " can be mixed
Ground is used.
Terminal can be implemented in a variety of manners.For example, the terminal described in the present invention can include such as mobile phone, flat board
Computer, notebook computer, palm PC, personal digital assistant (Personal Digital Assistant, PDA), portable
Media player (Portable Media Player, PMP), guider, wearable device, Intelligent bracelet, pedometer etc. are moved
Move the fixed terminals such as terminal, and numeral TV, desktop computer.
It will be illustrated in subsequent descriptions by taking mobile terminal as an example, it will be appreciated by those skilled in the art that except special
Outside element for moving purpose, construction according to the embodiment of the present invention can also apply to the terminal of fixed type.
Referring to Fig. 1, its hardware architecture diagram for a kind of mobile terminal of realization each embodiment of the invention, the shifting
Dynamic terminal 100 can include:RF (Radio Frequency, radio frequency) unit 101, WiFi module 102, audio output unit
103rd, A/V (audio/video) input block 104, sensor 105, display unit 106, user input unit 107, interface unit
108th, the part such as memory 109, processor 110 and power supply 111.It will be understood by those skilled in the art that shown in Fig. 1
Mobile terminal structure does not constitute the restriction to mobile terminal, and mobile terminal can be included than illustrating more or less parts,
Either combine some parts or different parts arrangement.
The all parts of mobile terminal are specifically introduced with reference to Fig. 1:
Radio frequency unit 101 can be used for receiving and sending messages or communication process in, the reception and transmission of signal, specifically, by base station
Downlink information receive after, handled to processor 110;In addition, up data are sent into base station.Generally, radio frequency unit 101
Including but not limited to antenna, at least one amplifier, transceiver, coupler, low-noise amplifier, duplexer etc..In addition, penetrating
Frequency unit 101 can also be communicated by radio communication with network and other equipment.Above-mentioned radio communication can use any communication
Standard or agreement, including but not limited to GSM (Global System of Mobile communication, global system for mobile telecommunications
System), GPRS (General Packet Radio Service, general packet radio service), CDMA2000 (Code
Division Multiple Access 2000, CDMA 2000), WCDMA (Wideband Code Division
Multiple Access, WCDMA), TD-SCDMA (Time Division-Synchronous Code
Division Multiple Access, TD SDMA), FDD-LTE (Frequency Division
Duplexing-Long Term Evolution, FDD Long Term Evolution) and TDD-LTE (Time Division
Duplexing-Long Term Evolution, time division duplex Long Term Evolution) etc..
WiFi belongs to short range wireless transmission technology, and mobile terminal can help user's transmitting-receiving electricity by WiFi module 102
Sub- mail, browse webpage and access streaming video etc., it has provided the user wireless broadband internet and accessed.Although Fig. 1 shows
Go out WiFi module 102, but it is understood that, it is simultaneously not belonging to must be configured into for mobile terminal, completely can be according to need
To be omitted in the essential scope for do not change invention.
Audio output unit 103 can be in call signal reception pattern, call mode, record mould in mobile terminal 1 00
When under the isotypes such as formula, speech recognition mode, broadcast reception mode, it is that radio frequency unit 101 or WiFi module 102 are received or
The voice data stored in memory 109 is converted into audio signal and is output as sound.Moreover, audio output unit 103
The audio output related to the specific function that mobile terminal 1 00 is performed can also be provided (for example, call signal receives sound, disappeared
Breath receives sound etc.).Audio output unit 103 can include loudspeaker, buzzer etc..
A/V input blocks 104 are used to receive audio or video signal.A/V input blocks 104 can include graphics processor
(Graphics Processing Unit, GPU) 1041 and microphone 1042,1041 pairs of graphics processor is in video acquisition mode
Or the view data progress of the static images or video obtained in image capture mode by image capture apparatus (such as camera)
Reason.Picture frame after processing may be displayed on display unit 106.Picture frame after being handled through graphics processor 1041 can be deposited
Storage is transmitted in memory 109 (or other storage mediums) or via radio frequency unit 101 or WiFi module 102.Mike
Wind 1042 can connect in telephone calling model, logging mode, speech recognition mode etc. operational mode via microphone 1042
Quiet down sound (voice data), and can be voice data by such acoustic processing.Audio (voice) data after processing can
To be converted to the form output that mobile communication base station can be sent to via radio frequency unit 101 in the case of telephone calling model.
Microphone 1042 can implement various types of noises and eliminate (or suppression) algorithm to eliminate (or suppression) in reception and send sound
The noise produced during frequency signal or interference.
Mobile terminal 1 00 also includes at least one sensor 105, such as optical sensor, motion sensor and other biographies
Sensor.Specifically, optical sensor includes ambient light sensor and proximity transducer, wherein, ambient light sensor can be according to environment
The light and shade of light adjusts the brightness of display panel 1061, and proximity transducer can close when mobile terminal 1 00 is moved in one's ear
Display panel 1061 and/or backlight.As one kind of motion sensor, accelerometer sensor can detect in all directions (general
For three axles) size of acceleration, size and the direction of gravity are can detect that when static, the application available for identification mobile phone posture
(such as horizontal/vertical screen switching, dependent game, magnetometer pose calibrating), Vibration identification correlation function (such as pedometer, percussion) etc.;
The fingerprint sensor that can also configure as mobile phone, pressure sensor, iris sensor, molecule sensor, gyroscope, barometer,
The other sensors such as hygrometer, thermometer, infrared ray sensor, will not be repeated here.
Display unit 106 is used for the information for showing the information inputted by user or being supplied to user.Display unit 106 can be wrapped
Display panel 1061 is included, liquid crystal display (Liquid Crystal Display, LCD), Organic Light Emitting Diode can be used
Forms such as (Organic Light-Emitting Diode, OLED) configures display panel 1061.
User input unit 107 can be used for the numeral or character information for receiving input, and produce the use with mobile terminal
The key signals input that family is set and function control is relevant.Specifically, user input unit 107 may include contact panel 1071 with
And other input equipments 1072.Contact panel 1071, also referred to as touch-screen, collect touch operation of the user on or near it
(such as user is using any suitable objects such as finger, stylus or annex on contact panel 1071 or in contact panel 1071
Neighbouring operation), and corresponding attachment means are driven according to formula set in advance.Contact panel 1071 may include touch detection
Two parts of device and touch controller.Wherein, touch detecting apparatus detects the touch orientation of user, and detects touch operation band
The signal come, transmits a signal to touch controller;Touch controller receives touch information from touch detecting apparatus, and by it
It is converted into contact coordinate, then gives processor 110, and the order sent of reception processing device 110 and can be performed.In addition, can
To realize contact panel 1071 using polytypes such as resistance-type, condenser type, infrared ray and surface acoustic waves.Except contact panel
1071, user input unit 107 can also include other input equipments 1072.Specifically, other input equipments 1072 can be wrapped
Include but be not limited to physical keyboard, in function key (such as volume control button, switch key etc.), trace ball, mouse, action bars etc.
One or more, do not limit herein specifically.
Further, contact panel 1071 can cover display panel 1061, detect thereon when contact panel 1071 or
After neighbouring touch operation, processor 110 is sent to determine the type of touch event, with preprocessor 110 according to touch thing
The type of part provides corresponding visual output on display panel 1061.Although in Fig. 1, contact panel 1071 and display panel
1061 be input and the output function that mobile terminal is realized as two independent parts, but in certain embodiments, can
By contact panel 1071 and the input that is integrated and realizing mobile terminal of display panel 1061 and output function, not do specifically herein
Limit.
Interface unit 108 is connected the interface that can pass through as at least one external device (ED) with mobile terminal 1 00.For example,
External device (ED) can include wired or wireless head-band earphone port, external power source (or battery charger) port, wired or nothing
Line FPDP, memory card port, the port for connecting the device with identification module, audio input/output (I/O) end
Mouth, video i/o port, ear port etc..Interface unit 108 can be used for receiving the input from external device (ED) (for example, number
It is believed that breath, electric power etc.) and the input received is transferred to one or more elements in mobile terminal 1 00 or can be with
For transmitting data between mobile terminal 1 00 and external device (ED).
Memory 109 can be used for storage software program and various data.Memory 109 can mainly include storing program area
And storage data field, wherein, application program (the such as sound that storing program area can be needed for storage program area, at least one function
Sound playing function, image player function etc.) etc.;Storage data field can be stored uses created data (such as according to mobile phone
Voice data, phone directory etc.) etc..In addition, memory 109 can include high-speed random access memory, it can also include non-easy
The property lost memory, for example, at least one disk memory, flush memory device or other volatile solid-state parts.
Processor 110 is the control centre of mobile terminal, utilizes each of various interfaces and the whole mobile terminal of connection
Individual part, by operation or performs and is stored in software program and/or module in memory 109, and calls and be stored in storage
Data in device 109, perform the various functions and processing data of mobile terminal, so as to carry out integral monitoring to mobile terminal.Place
Reason device 110 may include one or more processing units;It is preferred that, processor 110 can integrated application processor and modulatedemodulate mediate
Device is managed, wherein, application processor mainly handles operating system, user interface and application program etc., and modem processor is main
Handle radio communication.It is understood that above-mentioned modem processor can not also be integrated into processor 110.
Mobile terminal 1 00 can also include the power supply 111 (such as battery) powered to all parts, it is preferred that power supply 111
Can be logically contiguous by power-supply management system and processor 110, so as to realize management charging by power-supply management system, put
The function such as electricity and power managed.
Although Fig. 1 is not shown, mobile terminal 1 00 can also will not be repeated here including bluetooth module etc..
For the ease of understanding the embodiment of the present invention, the communications network system that the mobile terminal of the present invention is based on is entered below
Row description.
Referring to Fig. 2, Fig. 2 is a kind of communications network system Organization Chart provided in an embodiment of the present invention, the communication network system
Unite as the LTE system of universal mobile communications technology, UE (User Equipment, use of the LTE system including communicating connection successively
Family equipment) 201, E-UTRAN (Evolved UMTS Terrestrial Radio Access Network, evolved UMTS lands
Ground wireless access network) 202, EPC (Evolved Packet Core, evolved packet-based core networks) 203 and operator IP operation
204。
Specifically, UE201 can be above-mentioned terminal 100, and here is omitted.
E-UTRAN202 includes eNodeB2021 and other eNodeB2022 etc..Wherein, eNodeB2021 can be by returning
Journey (backhaul) (such as X2 interface) is connected with other eNodeB2022, and eNodeB2021 is connected to EPC203,
ENodeB2021 can provide UE201 to EPC203 access.
EPC203 can include MME (Mobility Management Entity, mobility management entity) 2031, HSS
(Home Subscriber Server, home subscriber server) 2032, other MME2033, SGW (Serving Gate Way,
Gateway) 2034, PGW (PDN Gate Way, grouped data network gateway) 2035 and PCRF (Policy and
Charging Rules Function, policy and rate functional entity) 2036 etc..Wherein, MME2031 be processing UE201 and
There is provided carrying and connection management for the control node of signaling between EPC203.HSS2032 is all to manage for providing some registers
Such as function of attaching position register (not shown) etc, and some are preserved about the use such as service features, data rate
The special information in family.All customer data can be transmitted by SGW2034, and PGW2035 can provide UE 201 IP
Address is distributed and other functions, and PCRF2036 is strategy and the charging control strategic decision-making of business data flow and IP bearing resources
Point, it selects and provided available strategy and charging control decision-making with charge execution function unit (not shown) for strategy.
IP operation 204 can include internet, Intranet, IMS (IP Multimedia Subsystem, IP multimedia
System) or other IP operations etc..
Although above-mentioned be described by taking LTE system as an example, those skilled in the art it is to be understood that the present invention not only
Suitable for LTE system, be readily applicable to other wireless communication systems, such as GSM, CDMA2000, WCDMA, TD-SCDMA with
And following new network system etc., do not limit herein.
Based on above-mentioned mobile terminal hardware configuration and communications network system, each embodiment of the inventive method is proposed.
First embodiment
Prevent from caching penetrating method as shown in figure 3, first embodiment of the invention provides one kind, methods described includes step:
31st, client request cache information, wherein the request bag includes key assignments.
32nd, the received server-side request, cache size is obtained according to the key assignments into server end caching system.
In the present embodiment, server end caching system can be Redis caching systems or similarly cache
System.Redis is a high performance Key-Value database.
33rd, judge whether the cache size obtained is null value.
If the 34, the cache size obtained is not null value, judge whether the cache size obtained is sky default value;
If the cache size the 35, obtained is empty default value, the empty default value is converted into the return of sky data described to visitor
Family end.
In the present embodiment, the empty default value includes additional character or special character string.Empty default value represent key assignments without
Correspondence business datum.
For example:According to ID come data cached, the ID that client is uploaded in server-side system database not
In the presence of;Because data are not present, if being not inserted into data into caching, the multiple request of client, every time request can all be penetrated
Caching, server-side system of going directly, all can build-up of pressure including database to server-side system.
Therefore, the present embodiment is by the case of business datum is non-existent, by setting empty default value to be inserted into caching
In correspondence key assignments, caching can be avoided to penetrate, prevent malicious attack, reduce the influence caused to back-end system database.
It refer to shown in Fig. 4, in one embodiment, methods described also includes step:
If the 341, the cache size obtained is not empty default value, judge whether the cache size obtained is NX default values;
In the present embodiment, by taking Redis caching systems as an example, NX default values represent to insert during the Setnx operations for performing Redis
The default value entered, represents that the value is currently written into.
If the 342, the cache size obtained is NX default values, data are read from standby caching system according to the key assignments,
And return to the client by data are read.
In the present embodiment, the key assignments in standby caching system is different from the key assignments in server end caching system, specifically
Ground can be " key assignments in server end caching system "+" backache ".
In this embodiment, by using active and standby caching, data are caused to penetrate under prevention key assignments failure conditions.
It refer again to shown in Fig. 4, further, methods described also includes step:
If the 343, the cache size obtained is not NX default values, the cache size of acquisition is returned into the client.
It refer to shown in Fig. 5, in another embodiment, methods described also includes step:
331st, the write order of the server end caching system is called if the cache size obtained is null value, by NX default values
Write in the server end caching system;
By taking Redis caching systems as an example, the Setnx of Redis caching systems can be called if the cache size obtained is null value
Or Hsetnx orders, NX default values are write into Redis caching systems.
In this embodiment, using the write order of server end caching system simultaneously, it is ensured that will not be asked during Refresh Data
Seek server-side system database
332nd, judge whether the NX default values write-in runs succeeded;
, can be by judging whether Setnx orders run succeeded by taking Redis caching systems as an example, run succeeded return 1, loses
Lose return 0.
If the 333, NX default values write-in runs succeeded, data are read from server-side database, if from service
The data read in device client database are not null value, then the data read from server-side database are write into the server
Hold in caching system and standby caching system, and the data read from server-side database are returned into the client.
In the present embodiment, in the standby caching system effective time of data than in the server end caching system
The effective time of data is long.For example:The effective time of data in standby caching system is set than number in server end caching system
According to effective time length 10 minutes.When ensureing the failure of server end caching system, data will not be directed through server end system
System database.
Further, methods described also includes step (accompanying drawing is not shown):
If the data read from server-side database are null value, empty default value is write into the server end and cached
In system and standby caching system, and empty default value is converted to described in the return of sky data to client.
Further, methods described also includes step (accompanying drawing is not shown):
If the NX default values write-in execution is unsuccessful, data are read from standby caching system, and data will be read
Return to the client.
One kind provided in an embodiment of the present invention prevents caching penetrating method, is stored by newly-increased null value, prevents malicious attack,
Reduce the influence caused to server-side system database;Using active and standby caching, data are caused to wear under prevention key assignments failure conditions
Thoroughly;Use the write order of server end caching system, it is ensured that will not be while request server end system database during Refresh Data.
Second embodiment
Reference picture 6, Fig. 6 for second embodiment of the invention provide it is a kind of prevent from caching the device penetrated, it is described to prevent caching
The device 40 penetrated includes:Memory 41, processor 42 and it is stored on the memory 41 and can be on the processor 42
That runs prevents caching from penetrating program, described to prevent caching from penetrating realization when program is performed by the processor 42 and preventing caching from wearing
The step of saturating method.
Specifically, the following steps for preventing caching penetrating method are realized:
Client asks cache information, wherein the request bag includes key assignments;
The received server-side request, cache size is obtained according to the key assignments into server end caching system;
Judge whether the cache size obtained is null value;
If the cache size obtained is not null value, judge whether the cache size obtained is sky default value;
If the cache size obtained is empty default value, the empty default value is converted into the return of sky data described to client
End.
In the present embodiment, by setting empty default value to be inserted into caching correspondence key assignments, caching can be avoided to penetrate, prevented
Malicious attack, reduces the influence caused to back-end system database.
In one embodiment, it is described when preventing that caching from penetrating program and performed by the processor 42, it is additionally operable to realize
Following steps:
If the cache size obtained is not empty default value, judge whether the cache size obtained is NX default values;
If the cache size obtained is NX default values, data are read from standby caching system according to the key assignments, and will
Read data and return to the client.
If the cache size obtained is not NX default values, the cache size of acquisition is returned into the client.
In this embodiment, by using active and standby caching, data are caused to penetrate under prevention key assignments failure conditions.
In another embodiment, it is described when preventing that caching from penetrating program and performed by the processor 42, it is additionally operable to reality
Existing following steps:
The write order of the server end caching system is called if the cache size obtained is null value, NX default values are write
In the server end caching system;
Judge whether the NX default values write-in runs succeeded;
If NX default values write-in runs succeeded, data are read from server-side database, if from server end
The data read in database are not null value, then the data read from server-side database are write into the server end delays
In deposit system and standby caching system, and the data read from server-side database are returned into the client.
If the NX default values write-in execution is unsuccessful, data are read from standby caching system, and data will be read
Return to the client.
If the data read from server-side database are null value, empty default value is write into the server end and cached
In system and standby caching system, and empty default value is converted to described in the return of sky data to client.
In this embodiment, using the write order of server end caching system simultaneously, it is ensured that will not be asked during Refresh Data
Seek server-side system database
One kind provided in an embodiment of the present invention prevents caching penetrating device, is stored by newly-increased null value, prevents malicious attack,
Reduce the influence caused to server-side system database;Using active and standby caching, data are caused to wear under prevention key assignments failure conditions
Thoroughly;Use the write order of server end caching system, it is ensured that will not be while request server end system database during Refresh Data.
3rd embodiment
Third embodiment of the invention is provided deposits on a kind of computer-readable recording medium, the computer-readable recording medium
Containing prevents that caching from penetrating program, it is described prevent from caching realized when the program of penetrating is executed by processor and prevent from caching penetrating method
Step.
Specifically, the following steps for preventing caching penetrating method are realized:
Client asks cache information, wherein the request bag includes key assignments;
The received server-side request, cache size is obtained according to the key assignments into server end caching system;
Judge whether the cache size obtained is null value;
If the cache size obtained is not null value, judge whether the cache size obtained is sky default value;
If the cache size obtained is empty default value, the empty default value is converted into the return of sky data described to client
End.
In the present embodiment, by setting empty default value to be inserted into caching correspondence key assignments, caching can be avoided to penetrate, prevented
Malicious attack, reduces the influence caused to back-end system database.
In one embodiment, it is described to prevent caching from penetrating realization when program is executed by processor and preventing the caching side of penetrating
The following steps of method:
If the cache size obtained is not empty default value, judge whether the cache size obtained is NX default values;
If the cache size obtained is NX default values, data are read from standby caching system according to the key assignments, and will
Read data and return to the client.
If the cache size obtained is not NX default values, the cache size of acquisition is returned into the client.
In this embodiment, by using active and standby caching, data are caused to penetrate under prevention key assignments failure conditions.
In another embodiment, it is described to prevent caching from penetrating realization when program is executed by processor and preventing caching from penetrating
The following steps of method:
The write order of the server end caching system is called if the cache size obtained is null value, NX default values are write
In the server end caching system;
Judge whether the NX default values write-in runs succeeded;
If NX default values write-in runs succeeded, data are read from server-side database, if from server end
The data read in database are not null value, then the data read from server-side database are write into the server end delays
In deposit system and standby caching system, and the data read from server-side database are returned into the client.
If the NX default values write-in execution is unsuccessful, data are read from standby caching system, and data will be read
Return to the client.
If the data read from server-side database are null value, empty default value is write into the server end and cached
In system and standby caching system, and empty default value is converted to described in the return of sky data to client.
In this embodiment, using the write order of server end caching system simultaneously, it is ensured that will not be asked during Refresh Data
Seek server-side system database
Computer-readable recording medium provided in an embodiment of the present invention, is stored by newly-increased null value, prevents malicious attack, dropped
The low influence caused to server-side system database;Using active and standby caching, data are caused to penetrate under prevention key assignments failure conditions;
Use the write order of server end caching system, it is ensured that will not be while request server end system database during Refresh Data.
It should be noted that herein, term " comprising ", "comprising" or its any other variant are intended to non-row
His property is included, so that process, method, article or device including a series of key elements not only include those key elements, and
And also including other key elements being not expressly set out, or also include for this process, method, article or device institute inherently
Key element.In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that including this
Also there is other identical element in process, method, article or the device of key element.
The embodiments of the present invention are for illustration only, and the quality of embodiment is not represented.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side
Method can add the mode of required general hardware platform to realize by software, naturally it is also possible to by hardware, but in many cases
The former is more preferably embodiment.Understood based on such, technical scheme is substantially done to prior art in other words
Going out the part of contribution can be embodied in the form of software product, and the computer software product is stored in a storage medium
In (such as ROM/RAM, magnetic disc, CD), including some instructions are to cause a station terminal (can be mobile phone, computer, service
Device, air conditioner, or network equipment etc.) perform method described in each of the invention embodiment.
Embodiments of the invention are described above in conjunction with accompanying drawing, but the invention is not limited in above-mentioned specific
Embodiment, above-mentioned embodiment is only schematical, rather than restricted, one of ordinary skill in the art
Under the enlightenment of the present invention, in the case of present inventive concept and scope of the claimed protection is not departed from, it can also make a lot
Form, these are belonged within the protection of the present invention.
Claims (10)
1. one kind prevents from caching penetrating method, methods described includes step:
Client asks cache information, wherein the request bag includes key assignments;
The received server-side request, cache size is obtained according to the key assignments into server end caching system;
Judge whether the cache size obtained is null value;
If the cache size obtained is not null value, judge whether the cache size obtained is sky default value;
If the cache size obtained is empty default value, the empty default value is converted into the return of sky data described to client.
2. one kind according to claim 1 prevents from caching penetrating method, it is characterised in that it is special that the empty default value includes
Symbol or special character string.
3. one kind according to claim 1 prevents from caching penetrating method, it is characterised in that methods described also includes step:
If the cache size obtained is not empty default value, judge whether the cache size obtained is NX default values;
If the cache size obtained is NX default values, data are read from standby caching system according to the key assignments, and will read
Data return to the client.
4. one kind according to claim 3 prevents from caching penetrating method, it is characterised in that methods described also includes step:
If the cache size obtained is not NX default values, the cache size of acquisition is returned into the client.
5. one kind according to claim 1 prevents from caching penetrating method, it is characterised in that methods described also includes step:
The write order of the server end caching system is called if the cache size obtained is null value, NX default values are write described
In server end caching system;
Judge whether the NX default values write-in runs succeeded;
If NX default values write-in runs succeeded, data are read from server-side database, if from servers' data
The data read in storehouse are not null value, then the data read from server-side database are write into the server end caching is
In system and standby caching system, and the data read from server-side database are returned into the client.
6. one kind according to claim 5 prevents from caching penetrating method, it is characterised in that methods described also includes step:
If the NX default values write-in execution is unsuccessful, data are read from standby caching system, and data return will be read
To the client.
7. one kind according to claim 5 prevents from caching penetrating method, it is characterised in that methods described also includes step:
If the data read from server-side database are null value, empty default value is write into the server end caching system
Be converted in standby caching system, and by empty default value described in the return of sky data to client.
8. one kind according to claim 5 prevents from caching penetrating method, it is characterised in that number in the standby caching system
According to effective time it is longer than the effective time of data in the server end caching system.
9. a kind of prevent from caching the device penetrated, it is characterised in that described to prevent that caching the device penetrated includes:Memory, place
Reason device and the caching that prevents that is stored on the memory and can run on the processor penetrate program, described to prevent caching
Program is penetrated by realizing that preventing as any one of claim 1 to 8 caches penetrating method during the computing device
Step.
10. a kind of computer-readable recording medium, it is characterised in that being stored with the computer-readable recording medium prevents from delaying
Deposit the program of penetrating, it is described prevent from caching realized when the program of penetrating is executed by processor as any one of claim 1 to 8
The step of preventing caching penetrating method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710372299.7A CN107124466B (en) | 2017-05-23 | 2017-05-23 | Method and device for preventing cache from penetrating and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710372299.7A CN107124466B (en) | 2017-05-23 | 2017-05-23 | Method and device for preventing cache from penetrating and computer readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107124466A true CN107124466A (en) | 2017-09-01 |
CN107124466B CN107124466B (en) | 2020-12-29 |
Family
ID=59730167
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710372299.7A Active CN107124466B (en) | 2017-05-23 | 2017-05-23 | Method and device for preventing cache from penetrating and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107124466B (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109710644A (en) * | 2018-12-26 | 2019-05-03 | 苏州思必驰信息科技有限公司 | The method and apparatus for preventing caching from penetrating |
CN110019366A (en) * | 2017-12-21 | 2019-07-16 | 北京京东尚科信息技术有限公司 | A kind of data cached method and apparatus |
CN110109956A (en) * | 2019-03-21 | 2019-08-09 | 福建天泉教育科技有限公司 | A kind of method and terminal for preventing caching from penetrating |
CN113282621A (en) * | 2021-04-23 | 2021-08-20 | 北京皮尔布莱尼软件有限公司 | Processing method of cache data and computing equipment |
CN114116796A (en) * | 2021-11-02 | 2022-03-01 | 浪潮云信息技术股份公司 | Distributed cache system for preventing cache treading |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103514106A (en) * | 2012-06-20 | 2014-01-15 | 北京神州泰岳软件股份有限公司 | Method for caching data |
CN104281668A (en) * | 2014-09-28 | 2015-01-14 | 墨仕(厦门)电子商务有限公司 | Data processing method |
CN105354151A (en) * | 2014-08-19 | 2016-02-24 | 阿里巴巴集团控股有限公司 | Cache management method and device |
CN105554106A (en) * | 2015-12-15 | 2016-05-04 | 上海仪电(集团)有限公司 | Memcache distributed caching system |
US9369332B1 (en) * | 2013-02-27 | 2016-06-14 | Amazon Technologies, Inc. | In-memory distributed cache |
CN106126673A (en) * | 2016-06-29 | 2016-11-16 | 上海浦东发展银行股份有限公司信用卡中心 | A kind of based on Redis and HBase point of locking method |
-
2017
- 2017-05-23 CN CN201710372299.7A patent/CN107124466B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103514106A (en) * | 2012-06-20 | 2014-01-15 | 北京神州泰岳软件股份有限公司 | Method for caching data |
US9369332B1 (en) * | 2013-02-27 | 2016-06-14 | Amazon Technologies, Inc. | In-memory distributed cache |
CN105354151A (en) * | 2014-08-19 | 2016-02-24 | 阿里巴巴集团控股有限公司 | Cache management method and device |
CN104281668A (en) * | 2014-09-28 | 2015-01-14 | 墨仕(厦门)电子商务有限公司 | Data processing method |
CN105554106A (en) * | 2015-12-15 | 2016-05-04 | 上海仪电(集团)有限公司 | Memcache distributed caching system |
CN106126673A (en) * | 2016-06-29 | 2016-11-16 | 上海浦东发展银行股份有限公司信用卡中心 | A kind of based on Redis and HBase point of locking method |
Non-Patent Citations (1)
Title |
---|
CARLOSFU: "缓存系列文章--5.缓存穿透问题", 《HTTPS://WWW.ITEYE.COM/BLOG/CARLOSFU-2248185》 * |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110019366A (en) * | 2017-12-21 | 2019-07-16 | 北京京东尚科信息技术有限公司 | A kind of data cached method and apparatus |
CN109710644A (en) * | 2018-12-26 | 2019-05-03 | 苏州思必驰信息科技有限公司 | The method and apparatus for preventing caching from penetrating |
CN110109956A (en) * | 2019-03-21 | 2019-08-09 | 福建天泉教育科技有限公司 | A kind of method and terminal for preventing caching from penetrating |
CN113282621A (en) * | 2021-04-23 | 2021-08-20 | 北京皮尔布莱尼软件有限公司 | Processing method of cache data and computing equipment |
CN114116796A (en) * | 2021-11-02 | 2022-03-01 | 浪潮云信息技术股份公司 | Distributed cache system for preventing cache treading |
Also Published As
Publication number | Publication date |
---|---|
CN107124466B (en) | 2020-12-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107133092A (en) | Multi-thread synchronization processing method, terminal and computer-readable recording medium | |
CN107688607A (en) | The method and mobile terminal of a kind of database access, computer-readable recording medium | |
CN107197017A (en) | A kind of consuming method, terminal and computer-readable recording medium based on consumption queue | |
CN107027114A (en) | A kind of SIM card switching method, equipment and computer-readable recording medium | |
CN107193889A (en) | Ad blocking method, terminal and computer-readable recording medium | |
CN108052302A (en) | Association display methods, terminal and the computer readable storage medium of double-sided screen | |
CN107124466A (en) | One kind prevents caching penetrating method and device, computer-readable recording medium | |
CN106961706A (en) | Method, mobile terminal and the computer-readable recording medium of communication pattern switching | |
CN107508892A (en) | A kind of page access method, server and computer-readable recording medium | |
CN107436779A (en) | A kind of application management method, equipment and computer-readable recording medium | |
CN107145385A (en) | A kind of multitask interface display methods, mobile terminal and computer-readable storage medium | |
CN107340833A (en) | Terminal temperature control method, terminal and computer-readable recording medium | |
CN107181700A (en) | Control method, mobile terminal and the storage medium of application program for mobile terminal | |
CN107133302A (en) | Realize method, system, terminal and the computer-readable recording medium of data consistency | |
CN106953684A (en) | A kind of method for searching star, mobile terminal and computer-readable recording medium | |
CN107682547A (en) | A kind of voice messaging regulation and control method, equipment and computer-readable recording medium | |
CN107038245A (en) | Page switching method, mobile terminal and storage medium | |
CN106953989A (en) | Incoming call reminding method and device, terminal, computer-readable recording medium | |
CN107181865A (en) | Processing method, terminal and the computer-readable recording medium of unread short messages | |
CN107341067A (en) | A kind of keys deactivation processing method, equipment and computer-readable recording medium | |
CN107483804A (en) | A kind of image pickup method, mobile terminal and computer-readable recording medium | |
CN107390856A (en) | A kind of method, mobile terminal and storage medium for reducing mobile terminal power consumption | |
CN107766202A (en) | Daily record write-in method, apparatus and computer-readable recording medium based on Log4j | |
CN107133151A (en) | A kind of daily record data processing method, equipment and computer-readable recording medium | |
CN107426304A (en) | Method, system and the proxy server of interactive media resource |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |