CN109710644A - The method and apparatus for preventing caching from penetrating - Google Patents
The method and apparatus for preventing caching from penetrating Download PDFInfo
- Publication number
- CN109710644A CN109710644A CN201811600208.1A CN201811600208A CN109710644A CN 109710644 A CN109710644 A CN 109710644A CN 201811600208 A CN201811600208 A CN 201811600208A CN 109710644 A CN109710644 A CN 109710644A
- Authority
- CN
- China
- Prior art keywords
- caching
- query request
- lock
- party
- caching query
- 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.)
- Pending
Links
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The present invention discloses the method and apparatus for preventing caching from penetrating, wherein a method of prevent caching from penetrating, comprising: to receive caching query request, judge whether caching query request is legal;If caching query request is legal, inquires and judge whether caching hits the corresponding data of caching query request;If caching is not hit, obtains third party's lock and caching query request is locked;Judge whether caching query request successfully obtains third party's lock, wherein third party's lock has default release time;If successfully obtaining third party's lock, the corresponding data of caching query request are submitted to caching by access backstage, and the semaphore that data are arranged is to have cached.A possibility that scheme of the present embodiment enables to caching to penetrate almost 0, direct effect are that the hit rate of caching is got higher, while greatly ensure that original performance.Deep layer effect is that the handling capacity of project directly rises.
Description
Technical field
The invention belongs to caching technology fields, more particularly to the method and apparatus for preventing caching from penetrating.
Background technique
Caching, which penetrates, refers to one data being centainly not present of inquiry, since caching is to need to look into from database when being not hit by
It askes, can not find out data and be then not written into caching, this will lead to the data that this is not present and requests to go to inquire to database every time,
Caching is caused to penetrate.
In the related technology, there are some schemes for preventing caching from penetrating on the market, can solve most of problem, but or it is more
Or few all existing defects.For example it caches preheating, L2 cache, locking, bloom filter (Bloom filter), use queue
Deng.
These technologies can be applied in combination, and also can be used alone, such as the combination such as caching preheating, L2 cache, locking
It can prevent the caching in the case of high concurrent from penetrating.Also queue can be used and realize a token bucket algorithm, the stream that can will be poured in
Amount is scabbled, step-by-step processing.
Situations such as preventing client malicious attack, can also refer to the thinking of bloom filter.
Inventor has found that above scheme at least has the following deficiencies: during realizing the application
1) malicious traffic stream can not be prevented;
2) technology complexity itself is high;
3) performance declines;
4) it is assisted with the technology of other field, can not fundamentally prevent caching from penetrating.
Summary of the invention
The embodiment of the present invention provides a kind of method and apparatus for preventing caching from penetrating, at least solving above-mentioned technical problem
One of.
In a first aspect, the embodiment of the present invention provides a kind of method for preventing caching from penetrating, comprising: receive caching query and ask
It asks, judges whether the caching query request is legal;If the caching query request is legal, inquires and judge whether caching orders
Described in the corresponding data of caching query request;If caching is not hit, obtains third party's lock and the caching query is asked
It asks and is locked;Judge whether the caching query request successfully obtains third party's lock, wherein having for third party's lock is pre-
If release time;If successfully obtaining third party's lock, the corresponding data of caching query request are submitted to slow by access backstage
The semaphore deposited, and the data are arranged is to have cached.
Second aspect, the embodiment of the present invention provide a kind of device for preventing caching from penetrating, comprising: legal judgment module is matched
It is set to and receives caching query request, judge whether the caching query request is legal;Judgment module is hit, if being configured to described slow
It deposits that inquiry request is legal, then inquire and judges whether caching hits the corresponding data of the caching query request;Lock obtains mould
Block is not hit if being configured to caching, is obtained third party's lock and is locked to caching query request;Acquisition judges mould
Block is configured to judge whether the caching query request successfully obtains third party's lock, wherein having for third party's lock is default
Release time;Cache module is submitted, if being configured to successfully obtain third party's lock, access backstage is right by caching query request institute
The data answered are submitted to caching, and the semaphore that the data are arranged is to have cached.
The third aspect provides a kind of electronic equipment comprising: at least one processor, and with described at least one
Manage the memory of device communication connection, wherein the memory is stored with the instruction that can be executed by least one described processor, institute
It states instruction to be executed by least one described processor, so that at least one described processor is able to carry out any embodiment of the present invention
Prevent caching penetrate method the step of.
Fourth aspect, the embodiment of the present invention also provide a kind of computer program product, and the computer program product includes
The computer program being stored on non-volatile computer readable storage medium storing program for executing, the computer program include program instruction, when
When described program instruction is computer-executed, the computer is made to execute the side for preventing caching from penetrating of any embodiment of the present invention
The step of method.
A possibility that scheme that the present processes and device provide enables to caching to penetrate almost 0, direct effect
It is that the hit rate cached is got higher, while greatly ensure that original performance.Deep layer effect is that the handling capacity of project is direct
Rise.
Detailed description of the invention
In order to illustrate the technical solution of the embodiments of the present invention more clearly, required use in being described below to embodiment
Attached drawing be briefly described, it should be apparent that, drawings in the following description are some embodiments of the invention, for ability
For the those of ordinary skill of domain, without creative efforts, it can also be obtained according to these attached drawings other attached
Figure.
Fig. 1 is a kind of flow chart for method for preventing caching from penetrating that one embodiment of the invention provides;
Fig. 2 is the flow chart for the method that the another kind that one embodiment of the invention provides prevents caching from penetrating;
Fig. 3 is the flow chart for another method for preventing caching from penetrating that one embodiment of the invention provides;
Fig. 4 is a kind of process of a specific example of scheme for preventing caching from penetrating that one embodiment of the invention provides
Figure;
Fig. 5 is a kind of block diagram for device for preventing caching from penetrating that one embodiment of the invention provides;
Fig. 6 is the structural schematic diagram for the electronic equipment that one embodiment of the invention provides.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention
In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is
A part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art
Every other embodiment obtained without creative efforts, shall fall within the protection scope of the present invention.
Referring to FIG. 1, it illustrates the flow chart of one embodiment of method for preventing caching from penetrating of the application, the present embodiment
Prevent the method that penetrates of caching to can be adapted for the equipment for having caching, such as there is the server of caching.
As shown in Figure 1, in a step 101, receiving caching query request, judge whether the caching query request is legal;
In a step 102, it if caching query request is legal, inquires and judges whether caching hits caching query request institute
Corresponding data;
In step 103, it if caching is not hit, obtains third party's lock and caching query request is locked;
At step 104, judge whether caching query request successfully obtains third party's lock, wherein third party's lock has
Default release time;
In step 105, if successfully obtaining third party's lock, the corresponding data of caching query request are submitted on access backstage
To caching, and the semaphore that data are arranged is to have cached.
In the present embodiment, for step 101, the device for preventing caching from penetrating receives the caching query request of user, and
Judge whether the request is legal.Later, for step 102, if the caching query request it is legal, inquire and judge caching in be
No there are above-mentioned caching queries to request requested data, that is, inquires and judge whether caching hits.Later, for step 103,
If caching obtains third party's lock and locks to caching query request, the quantity of lock is limited without hitting corresponding data
, the request for only obtaining third party's lock is able to access that backstage continues to inquire, and the request that third party's lock has not been obtained cannot visit
Backstage is asked, so that guaranteeing is not in that caching penetrates in the case where distributed system or high concurrent.
Then, for step 104, judge whether caching query request successfully fights for third party's lock, third party's lock has
Default release time, wherein the release of third party's lock is uniformly processed by third party, such as the can be discharged by way of time-out
Tripartite's lock, there is no limit herein by the application.It, can be with for successfully getting the request of third party's lock finally, for step 105
Accessing backstage and the data of request are submitted in caching the semaphore for caching, and the data being arranged is to have cached.
The method of the present embodiment is by first carrying out legal judgement to request, so that some illegal requests are filtered out, it
It inquires whether legal request is buffered hit afterwards, is not buffered life if not hitting and limiting in such a way that third party locks again
In request access to backstage, so as to avoid well caching penetrate the case where.
With further reference to Fig. 2, it illustrates the another kinds that one embodiment of the application provides to prevent from caching the method penetrated
Flow chart.The step that the method for the present embodiment is further limited primarily directed to the additional step after the step 104 in flow chart 1
Rapid flow chart.
As shown in Fig. 2, in step 201, if caching query request is failed to obtain third party's lock, inquiring the signal of data
Whether amount is to have cached;
In step 202, if semaphore is to have cached, query caching.
In the present embodiment, the request is inquired for not getting the request of third party's lock successfully for step 201
Whether the semaphore of corresponding data is to have cached.It later, is that the data cached can direct query caching for semaphore
Obtain corresponding data.
Whether the method for the present embodiment is to have cached by inquiry semaphore, can find quickly and semaphore was arranged as
The data of caching reduce query time so as to faster hiting data.
In some alternative embodiments, the above method further include: cached if not checked in default time-out time
Semaphore when, then direct query caching.The method of the present embodiment is spinned by being arranged while checking semaphore, is more than certainly
If also not detecting semaphore after the default time-out time of rotation, it will direct query caching, to prevent from not delaying at all
It deposits and wastes the excessive time in the data of semaphore.
In further alternative embodiment, semaphore has preset expiration time, method further include: if the letter cached
Number amount is more than the preset expiration time there are the time, then erasure signal amount and corresponding data cached.Thus will not be same in system
When there are many semaphores, reduce the query time of semaphore.
With further reference to Fig. 3, another provided it illustrates one embodiment of the application prevents from caching the method penetrated
Flow chart.Flow chart of the flow chart of the present embodiment primarily directed to the refinement step of step 101 in flow chart 1.
As shown in figure 3, in step 301, the default effective range requested in conjunction with Bloom filter limitation caching query;
In step 302, caching query request is judged whether in default effective range, if in default effective range
It is inside then legal, it is illegal if being not in effective range.
In the present embodiment, for step 301, Bloom filter, and benefit be may include in the device for preventing caching from penetrating
It is located in default effective range with Bloom filter limitation caching query request.For step 302, judge that caching query request is
It is no, if being in, to judge that the request for legitimate request, is preset in effective range if being not at this in default effective range,
Then judge the request for illegal request.
Further, after above-mentioned steps 101 judge whether caching query request is legal, the above method further include: if
Caching query request is illegal, then returns to mistake and abandon caching query request.
The present embodiment limits the effective range of request by introducing Bloom filter, judges whether the parameter of request closes
Method, and the request of discord hair is filtered out in advance, so as to prevent malicious requests well, reduce the processing of subsequent module
Amount, is effectively prevented caching and penetrates.
In some alternative embodiments, before receiving caching query request, method further include: hot spot data is carried out
Data preheating.To can first be preheated to hot spot data before project is online, to prevent online in a flash because slow
Deposit data directly results in caching for sky and penetrates.
In other optional embodiments, is inquiring and judging whether caching hits the corresponding number of caching query request
According to later, method further include: if cache hit, the corresponding data of return cache inquiry request.For the data of cache hit,
Data corresponding to return cache inquiry request, entire scheme form the scheme for completely preventing caching from penetrating and responding.
It should be noted that above method step be not limited to each step execute sequence, in fact, certain steps
It may be performed simultaneously or to execute with the opposite sequence that step limits, there is no limit herein by the application.
Below to some problems encountered in the implementation of the present invention by description inventor and to finally determination
One specific embodiment of scheme is illustrated, so that those skilled in the art more fully understand the scheme of the application.
Inventor has found that defect existing in the prior art is mainly led by following reason during realizing the application
It causes:
1) malicious traffic stream can not be prevented: although the problem of caching and L2 cache can be with effective solution cache hits,
It is that caching caused by can not handling high concurrent or malicious traffic stream well penetrates.
2) technology complexity itself is high: plus the processing of lock, it appears that the peak value of flow when can scabble high concurrent.But it locks
Processing itself be exactly troublesome thing.
3) under the distributed scene of multi-load, the presence of third party's lock also results in the decline of performance.It deletes for when
Except lock and a stubborn problem.
4) assisted with the technology of other field, can not fundamentally prevent caching from penetrating: token bucket algorithm is originally for solving
Certainly the problem of current limliting, the caching caused by reply high concurrent there is penetrated with certain effect.But artificially the degree of control flow is not
Be affectedly bashful well, and token bucket algorithm is only reduction of number of concurrent amount, that is to say, that can still exist it is a certain number of request penetrate it is slow
It deposits.
Wherein, token bucket algorithm (Leaky Bucket) is traffic shaping in network world (Traffic Shaping) or speed
A kind of algorithm being commonly used when rate limitation (Rate Limiting), its main purpose are that control data are injected into network
Rate, the burst flow on smooth network.Token bucket algorithm provides a kind of mechanism, by it, burst flow can be shaped with
Just a stable flow is provided for network.Leaky bucket can be regarded as the single server queue for having constant service time,
If leaky bucket (packet caching) is overflowed, data packet can be dropped.
In a network, token bucket algorithm can control the flow output speed of port, and the burst flow on smooth network is realized
Traffic shaping, to provide a stable flow for network.Token bucket algorithm forces the output speed of a constant but regardless of defeated
Enter the sudden of data flow.When inputting idle, which does not execute any movement;Host is infused in each timeslice to network
Enter a data packet, therefore produces consistent data flow, the flow of smooth burst;When data packet has identical size
It waits (such as ATM cell), the working mechanism that each timeslice transmits a data packet does not have any problems.But for variant pack
Long, there may be some problems for this working mechanism, at this point, the byte of preferably each timeslice transmission fixed number.Such as: such as
The each timeslice of fruit transmits 1024 bytes, then a timeslice allows to transmit the packet of 1024 bytes, two 512 bytes
The packet of packet or four 256 bytes.
Inventor also found that, in order to solve drawbacks described above existing in the prior art, the portioned product of the prior art may
It is solved by following method:
Above several technologies are often combined in industry, to achieve the effect that prevent caching from penetrating, for example, being applied in combination slow
Deposit preheating, locking, bloom filter etc..
It in computer field, speaks of and resource is fought for, generally all only will recognize that simple locking or controlled using queue
The mode of flow, so being less susceptible to expect the scheme of the application.
The scheme of the application, which is mainly started with from the following aspects, to be designed and optimizes:
Firstly, the case where causing caching to penetrate is varied, penetrated to perfectly solve the caching under all scenes, really
Need to be applied in combination various technologies in fact.However, it is desirable to guarantee as far as possible simple, effective.
It prevents malicious traffic stream: using parameter verification+bloom filter, but passing through verification, malicious traffic stream is uniformly referred to
To fixed caching.
It reduces implementation complexity: the complexity that there is height in itself is locked, because you need to consider various exceptions
Influence of the situation to lock.Problem is discharged by shelving lock the most complicated, reduces the implementation complexity of entire scheme.
Improve performance: that reduces lock fights for number.
Prevent it is some can not basic solution to problem be carried out: without using the scheme alleviating caching and penetrating, for example, limit
The thinking (token bucket algorithm) of stream.
Referring to FIG. 4, it illustrates the specific flow charts of one scheme of the application.
As shown in figure 4, the scheme of the application mainly comprises the steps that
1) before project is online, need first to preheat hot spot data, this be in order to prevent it is online in a flash because
For it is data cached be that sky causes to penetrate.
2) any requested next, first determine whether its parameter is legal, in conjunction with the effective of bloom filter limitation request
Illegal request is filtered out in advance, prevents malicious requests by range.
3) query caching, if hit directly returns the result;If do not hit, need to guarantee by third party's lock
It caches and penetrates in the case where distributed system or high concurrent.
4) release locked is uniformly processed by third party (here by time-out release).
5) request of lock is fought for, it will access backstage, and caching is submitted the data to, setting signal amount is to have delayed
It deposits.
6) in the request for not getting lock, the mode of semaphore is checked using spin & to reduce fighting for for lock, raising property
Energy.
7) spin setting time-out time, when semaphore being also not detected at the appointed time, it will direct query caching.
Wherein, it should be noted that:
1, spin lock is present in single association's journey, and acquisition opportunity is not rob to account for third party and lock it in association's journey confirmation
Afterwards, by assisting Cheng Benshen to spin and checking semaphore, number is fought for for what third party locked to reduce;
2, the effect of semaphore be notice institute either with or without seize third party lock association's journey, informing data be stored in it is slow
It deposits.Difference with semaphore concept in concurrency programming is that semaphore here is mainly an informing mechanism, and there is no strive
It robs;
3, all there is expired time in third party's lock, spin lock and semaphore, third party's lock, spin lock expired time be for
Preventing lock from not discharging causes to assist journey seemingly-dead;The expired time of semaphore is determined according to business, when duration≤service buffer fails
Between;
This programme makes caching a possibility that penetrating almost 0, and direct effect is that the hit rate of caching is got higher, while greatly
Limit ensure that original performance.Deep layer effect is that the handling capacity of project directly rises.
Referring to FIG. 5, the block diagram of the device for preventing caching from penetrating provided it illustrates one embodiment of the invention.
As shown in figure 5, the device 500 for preventing caching from penetrating, the embodiment of the present invention provides a kind of dress for preventing caching from penetrating
It sets, comprising: legal judgment module 510 is configured to receive caching query request, judges whether the caching query request is legal;
Judgment module 520 is hit, if it is legal to be configured to caching query request, inquires and judges whether caching hits the caching
Data corresponding to inquiry request;Lock obtains module 530, does not hit if being configured to caching, obtains third party's lock to described
Caching query request is locked;Judgment module 540 is obtained, is configured to judge whether the caching query request successfully obtains the
Tripartite's lock, wherein third party's lock has default release time;Cache module 550 is submitted, if being configured to successfully to obtain the
Tripartite's lock, the corresponding data of caching query request are submitted to caching by access backstage, and the signal of the data is arranged
Amount is to have cached.
It should be appreciated that all modules recorded in Fig. 5 are corresponding with each step in the method with reference to described in Fig. 1.By
This, operation and feature and corresponding technical effect above with respect to method description are equally applicable to all modules in Fig. 5, herein
It repeats no more.
It is worth noting that, the module in embodiment of the disclosure is not limited to the scheme of the disclosure, such as legal
Judgment module can be described as receiving caching query request, judge caching query request whether legal module.In addition, also
It can realize that related function module, such as legal judgment module can also be realized with processor by hardware processor, herein
It repeats no more.
In further embodiments, the embodiment of the invention also provides a kind of nonvolatile computer storage medias, calculate
Machine storage medium is stored with computer executable instructions, which can be performed in above-mentioned any means embodiment
Prevent the method that penetrates of caching;
As an implementation, nonvolatile computer storage media of the invention is stored with the executable finger of computer
It enables, computer executable instructions setting are as follows:
Caching query request is received, judges whether the caching query request is legal;
If the caching query request is legal, inquires and judge whether caching hits corresponding to the caching query request
Data;
If caching is not hit, obtains third party's lock and caching query request is locked;
Judge whether the caching query request successfully obtains third party's lock, wherein having for third party's lock is default
Release time;
If successfully obtaining third party's lock, the corresponding data of caching query request are submitted to caching by access backstage,
And the semaphore that the data are arranged is to have cached.
Non-volatile computer readable storage medium storing program for executing may include storing program area and storage data area, wherein storage journey
It sequence area can application program required for storage program area, at least one function;Storage data area can store basis and prevent from caching
The device penetrated uses created data etc..In addition, non-volatile computer readable storage medium storing program for executing may include high speed with
Machine access memory, can also include nonvolatile memory, a for example, at least disk memory, flush memory device or its
His non-volatile solid state memory part.In some embodiments, it includes opposite that non-volatile computer readable storage medium storing program for executing is optional
In the remotely located memory of processor, these remote memories can be by being connected to the network to the device for preventing caching from penetrating.
The example of above-mentioned network includes but is not limited to internet, intranet, local area network, mobile radio communication and combinations thereof.
The embodiment of the present invention also provides a kind of computer program product, and computer program product is non-volatile including being stored in
Computer program on computer readable storage medium, computer program include program instruction, when program instruction is held by computer
When row, computer is made to execute the method that any of the above-described prevents caching from penetrating.
Fig. 6 is the structural schematic diagram of electronic equipment provided in an embodiment of the present invention, as shown in fig. 6, the equipment includes: one
Or multiple processors 610 and memory 620, in Fig. 6 by taking a processor 610 as an example.The method for preventing caching from penetrating is set
Standby can also include: input unit 630 and output device 640.Processor 610, memory 620, input unit 630 and output dress
Setting 640 can be connected by bus or other modes, in Fig. 6 for being connected by bus.Memory 620 is above-mentioned non-
Volatile computer readable storage medium storing program for executing.The non-volatile software journey that processor 610 is stored in memory 620 by operation
Sequence, instruction and module, thereby executing the various function application and data processing of server, i.e. realization above method embodiment
The method for preventing caching from penetrating.Input unit 630 can receive the number or character information of input, and generates and wear with caching is prevented
The related key signals input of the user setting and function control of saturating device.Output device 640 may include the display such as display screen
Equipment.
Method provided by the embodiment of the present invention can be performed in the said goods, has the corresponding functional module of execution method and has
Beneficial effect.The not technical detail of detailed description in the present embodiment, reference can be made to method provided by the embodiment of the present invention.
As an implementation, above-mentioned electronic apparatus application is used for client, packet in the device for preventing caching from penetrating
It includes: at least one processor;And the memory being connect at least one processor communication;Wherein, be stored with can quilt for memory
At least one processor execute instruction, instruction executed by least one processor so that at least one processor can:
Caching query request is received, judges whether the caching query request is legal;
If the caching query request is legal, inquires and judge whether caching hits corresponding to the caching query request
Data;
If caching is not hit, obtains third party's lock and caching query request is locked;
Judge whether the caching query request successfully obtains third party's lock, wherein having for third party's lock is default
Release time;
If successfully obtaining third party's lock, the corresponding data of caching query request are submitted to caching by access backstage,
And the semaphore that the data are arranged is to have cached.
The electronic equipment of the embodiment of the present application exists in a variety of forms, including but not limited to:
(1) mobile communication equipment: the characteristics of this kind of equipment is that have mobile communication function, and to provide speech, data
Communication is main target.This Terminal Type includes: smart phone (such as iPhone), multimedia handset, functional mobile phone and low
Hold mobile phone etc..
(2) super mobile personal computer equipment: this kind of equipment belongs to the scope of personal computer, there is calculating and processing function
Can, generally also have mobile Internet access characteristic.This Terminal Type includes: PDA, MID and UMPC equipment etc., such as iPad.
(3) portable entertainment device: this kind of equipment can show and play multimedia content.Such equipment include: audio,
Video player (such as iPod), handheld device, e-book and intelligent toy and portable car-mounted navigation equipment.
(4) server: providing the equipment of the service of calculating, and the composition of server includes that processor, hard disk, memory, system are total
Line etc., server is similar with general computer architecture, but due to needing to provide highly reliable service, in processing energy
Power, stability, reliability, safety, scalability, manageability etc. are more demanding.
(5) other electronic devices with data interaction function.
The apparatus embodiments described above are merely exemplary, wherein unit can be as illustrated by the separation member
Or may not be and be physically separated, component shown as a unit may or may not be physical unit, i.e.,
It can be located in one place, or may be distributed over multiple network units.It can select according to the actual needs therein
Some or all of the modules achieves the purpose of the solution of this embodiment.Those of ordinary skill in the art are not paying creative labor
In the case where dynamic, it can understand and implement.
Through the above description of the embodiments, those skilled in the art can be understood that each embodiment can
It realizes by means of software and necessary general hardware platform, naturally it is also possible to pass through hardware.Based on this understanding, on
Stating technical solution, substantially the part that contributes to existing technology can be embodied in the form of software products in other words, should
Computer software product may be stored in a computer readable storage medium, such as ROM/RAM, magnetic disk, CD, including several fingers
It enables and using so that a computer equipment (can be personal computer, server or the network equipment etc.) executes each implementation
The method of certain parts of example or embodiment.
Finally, it should be noted that the above embodiments are merely illustrative of the technical solutions of the present invention, rather than its limitations;Although
Present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that: it still may be used
To modify the technical solutions described in the foregoing embodiments or equivalent replacement of some of the technical features;
And these are modified or replaceed, technical solution of various embodiments of the present invention that it does not separate the essence of the corresponding technical solution spirit and
Range.
Claims (10)
1. a kind of method for preventing caching from penetrating, comprising:
Caching query request is received, judges whether the caching query request is legal;
If the caching query request is legal, inquires and judge whether caching hits the corresponding number of the caching query request
According to;
If caching is not hit, obtains third party's lock and caching query request is locked;
Judge whether the caching query request successfully obtains third party's lock, wherein third party's lock has default release
Time;
If successfully obtaining third party's lock, the corresponding data of caching query request are submitted to caching by access backstage, and are set
The semaphore for setting the data is to have cached.
2. according to the method described in claim 1, wherein, judging whether the caching query request successfully obtains third described
After side's lock, the method also includes:
If the caching query request is failed to obtain third party's lock, whether the semaphore for inquiring the data is to have cached;
If the semaphore is to have cached, query caching.
3. according to the method described in claim 2, wherein, the method also includes:
If do not check the semaphore cached in default time-out time, direct query caching.
4. the semaphore has the preset expiration time according to the method described in claim 3, wherein, the method also includes:
If the semaphore cached there are the time be more than the preset expiration time, delete the semaphore and with the letter
Number corresponding data of amount.
It is described to judge whether the caching query request is legal and include: 5. according to the method described in claim 1, wherein
The default effective range that the caching query is requested is limited in conjunction with Bloom filter;
The caching query request is judged whether in the default effective range, if in the default effective range
It is legal, it is illegal if being not in the effective range.
6. according to the method described in claim 1, wherein, it is described judge whether the caching query request legal after, institute
State method further include:
If the caching query request is illegal, returns to mistake and abandon the caching query request.
7. method according to claim 1 to 6, wherein described before reception caching query request
Method further include:
Data preheating is carried out to hot spot data.
8. according to the method described in claim 7, wherein, in the inquiry and judging whether caching hits the caching query and ask
After seeking corresponding data, the method also includes:
If cache hit, returns to the caching query and request corresponding data.
9. a kind of electronic equipment comprising: at least one processor, and deposited with what at least one described processor communication was connect
Reservoir, wherein the memory be stored with can by least one described processor execute instruction, described instruction by it is described at least
One processor executes, so that at least one described processor is able to carry out the step of any one of claim 1 to 8 the method
Suddenly.
10. a kind of storage medium, is stored thereon with computer program, which is characterized in that real when described program is executed by processor
The step of any one of existing claim 1 to 8 the method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811600208.1A CN109710644A (en) | 2018-12-26 | 2018-12-26 | The method and apparatus for preventing caching from penetrating |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811600208.1A CN109710644A (en) | 2018-12-26 | 2018-12-26 | The method and apparatus for preventing caching from penetrating |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109710644A true CN109710644A (en) | 2019-05-03 |
Family
ID=66257724
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811600208.1A Pending CN109710644A (en) | 2018-12-26 | 2018-12-26 | The method and apparatus for preventing caching from penetrating |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109710644A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110727892A (en) * | 2019-09-24 | 2020-01-24 | 北京奇艺世纪科技有限公司 | Cache data updating method and device and electronic equipment |
CN110765138A (en) * | 2019-10-31 | 2020-02-07 | 北京达佳互联信息技术有限公司 | Data query method, device, server and storage medium |
CN112866179A (en) * | 2019-11-27 | 2021-05-28 | 北京沃东天骏信息技术有限公司 | Current limiting method and current limiting device |
CN116225728A (en) * | 2023-05-09 | 2023-06-06 | 北京星辰天合科技股份有限公司 | Task execution method and device based on coroutine, storage medium and electronic equipment |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130326154A1 (en) * | 2012-05-31 | 2013-12-05 | Samsung Electronics Co., Ltd. | Cache system optimized for cache miss detection |
CN105224251A (en) * | 2015-09-28 | 2016-01-06 | 浪潮(北京)电子信息产业有限公司 | A kind of Read-Write Locks optimization method based on Linux and system |
CN106453500A (en) * | 2016-09-07 | 2017-02-22 | 努比亚技术有限公司 | Cache generation and control method, cache server and interface server |
CN106445944A (en) * | 2015-08-06 | 2017-02-22 | 阿里巴巴集团控股有限公司 | Data query request processing method and apparatus, and electronic device |
CN106599721A (en) * | 2016-12-13 | 2017-04-26 | 微梦创科网络科技(中国)有限公司 | Cache-based data access method and apparatus |
CN107124466A (en) * | 2017-05-23 | 2017-09-01 | 努比亚技术有限公司 | One kind prevents caching penetrating method and device, computer-readable recording medium |
-
2018
- 2018-12-26 CN CN201811600208.1A patent/CN109710644A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130326154A1 (en) * | 2012-05-31 | 2013-12-05 | Samsung Electronics Co., Ltd. | Cache system optimized for cache miss detection |
CN106445944A (en) * | 2015-08-06 | 2017-02-22 | 阿里巴巴集团控股有限公司 | Data query request processing method and apparatus, and electronic device |
CN105224251A (en) * | 2015-09-28 | 2016-01-06 | 浪潮(北京)电子信息产业有限公司 | A kind of Read-Write Locks optimization method based on Linux and system |
CN106453500A (en) * | 2016-09-07 | 2017-02-22 | 努比亚技术有限公司 | Cache generation and control method, cache server and interface server |
CN106599721A (en) * | 2016-12-13 | 2017-04-26 | 微梦创科网络科技(中国)有限公司 | Cache-based data access method and apparatus |
CN107124466A (en) * | 2017-05-23 | 2017-09-01 | 努比亚技术有限公司 | One kind prevents caching penetrating method and device, computer-readable recording medium |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110727892A (en) * | 2019-09-24 | 2020-01-24 | 北京奇艺世纪科技有限公司 | Cache data updating method and device and electronic equipment |
CN110765138A (en) * | 2019-10-31 | 2020-02-07 | 北京达佳互联信息技术有限公司 | Data query method, device, server and storage medium |
CN112866179A (en) * | 2019-11-27 | 2021-05-28 | 北京沃东天骏信息技术有限公司 | Current limiting method and current limiting device |
CN112866179B (en) * | 2019-11-27 | 2023-06-27 | 北京沃东天骏信息技术有限公司 | Current limiting method and current limiting device |
CN116225728A (en) * | 2023-05-09 | 2023-06-06 | 北京星辰天合科技股份有限公司 | Task execution method and device based on coroutine, storage medium and electronic equipment |
CN116225728B (en) * | 2023-05-09 | 2023-07-14 | 北京星辰天合科技股份有限公司 | Task execution method and device based on coroutine, storage medium and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109710644A (en) | The method and apparatus for preventing caching from penetrating | |
US20190297109A1 (en) | Method and apparatus for processing account in blockchain, storage medium, and computer device | |
US7872975B2 (en) | File server pipelining with denial of service mitigation | |
WO2019137563A3 (en) | Anti-replay attack authentication protocol | |
US20130336323A1 (en) | Optimized bi-directional communication in an information centric network | |
CN104065644A (en) | Method and apparatus for recognizing CC attacks based on log analysis | |
CN102158492B (en) | Web authentication method, device and network equipment | |
CN109063437A (en) | A kind of asset of equipments operation audit method, device, equipment and readable storage medium storing program for executing | |
CN108833450B (en) | Method and device for preventing server from being attacked | |
CN108881233B (en) | Anti-attack processing method, device, equipment and storage medium | |
CN113381975B (en) | Internet of things security access control method based on block chain and fog node credit | |
TW202034197A (en) | Data Processing Method, Device, Access Control System, and Storage Media | |
CN106656514A (en) | kerberos authentication cluster access method, SparkStandalone cluster, and driving node of SparkStandalone cluster | |
CN105847277A (en) | Service account share management method and system used for third party application | |
CN106254394B (en) | A kind of recording method and device of attack traffic | |
CN107046516B (en) | Wind control method and device for identifying mobile terminal identity | |
CN108920099A (en) | Data dynamic storage system and method based on a variety of sliced fashions | |
CN109670807A (en) | It withholds control method, device, equipment and readable storage medium storing program for executing | |
CN106648938A (en) | Linux system application program memory management method and system | |
CN107707593A (en) | A kind of dynamic resource for improving cache hit rate accesses accelerating method and device | |
CN103778352A (en) | Electronic evidence generation and verification method and device as well as electronic evidence generation system | |
CN106612263B (en) | Method and equipment for processing application access request | |
CN103780589A (en) | Virus prompting method, client-terminal device and server | |
CN106682504A (en) | Method and device for preventing file from being maliciously edited and electronic equipment | |
WO2017050178A1 (en) | Data authentication method and device |
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 | ||
CB02 | Change of applicant information | ||
CB02 | Change of applicant information |
Address after: 215123 building 14, Tengfei Innovation Park, 388 Xinping street, Suzhou Industrial Park, Suzhou City, Jiangsu Province Applicant after: Sipic Technology Co.,Ltd. Address before: 215123 building 14, Tengfei Innovation Park, 388 Xinping street, Suzhou Industrial Park, Suzhou City, Jiangsu Province Applicant before: AI SPEECH Ltd. |