CN107436910A - A kind of data query method and apparatus - Google Patents

A kind of data query method and apparatus Download PDF

Info

Publication number
CN107436910A
CN107436910A CN201710245932.6A CN201710245932A CN107436910A CN 107436910 A CN107436910 A CN 107436910A CN 201710245932 A CN201710245932 A CN 201710245932A CN 107436910 A CN107436910 A CN 107436910A
Authority
CN
China
Prior art keywords
data
target data
cache blocks
cache
physical layer
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
Application number
CN201710245932.6A
Other languages
Chinese (zh)
Other versions
CN107436910B (en
Inventor
赵正邦
钟亮力
刘中胜
吴刚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Advanced New Technologies Co Ltd
Advantageous New Technologies Co Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201710245932.6A priority Critical patent/CN107436910B/en
Publication of CN107436910A publication Critical patent/CN107436910A/en
Application granted granted Critical
Publication of CN107436910B publication Critical patent/CN107436910B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The disclosure provides a kind of data query method and apparatus, and wherein method includes:Data inquiry request is received, the data inquiry request, which is used to inquire about, obtains target data;The target data is inquired about in local cache, when it is determined that needing to obtain the target data to physical layer data, cache blocks corresponding to target data described in local cache is performed and concurrently judge to operate;If operating result shows to there is currently no the concurrently inquiry to the target data, the target data is inquired about to physical layer data;Otherwise, the current data in the cache blocks is returned as the target data.The disclosure effectively prevent the phenomenon for caching breakdown occur.

Description

A kind of data query method and apparatus
Technical field
This disclosure relates to Internet technical field, more particularly to a kind of data query method and apparatus.
Background technology
When receiving the access request for certain data, in order to improve response efficiency, local cache can be generally arrived first Middle inquiry whether there is the data.Data are inquired about if there is no physical layer data is arrived again, then the data of acquisition are put into caching In, access hit caching next time and directly return;If caching time-out, physical layer data inquiry data are arrived again and are placed into slow In depositing.
The mode of above-mentioned acquisition data, puts up a good show in general, but in data access very frequently high frequency Under access environment, the risk of caching breakdown be present.For example if when data in the buffer just need to refresh, now arrive The substantial amounts of high-frequency data request reached may fall on physical layer data, cause data entity stressor layer moment to rise violently, be Caching breakdown, this stability to physical layer form great threat.
The content of the invention
In view of this, the disclosure provides a kind of data query method and apparatus, it is therefore an objective to prevents showing for caching breakdown As.
Specifically, the disclosure is achieved by the following technical solution:
First aspect, there is provided a kind of data query method, methods described include:
Data inquiry request is received, the data inquiry request, which is used to inquire about, obtains target data;
The target data is inquired about in local cache, when it is determined that needing to obtain the target data to physical layer data When, cache blocks corresponding to target data described in local cache are performed and concurrently judge to operate;
If operating result shows to there is currently no the concurrently inquiry to the target data, institute is inquired about to physical layer data State target data;Otherwise, the current data in the cache blocks is returned as the target data.
Second aspect, there is provided a kind of data query arrangement, described device include:
Request receiving module, for receiving data inquiry request, the data inquiry request, which is used to inquire about, obtains number of targets According to;
Buffer process module, for inquiring about the target data in local cache, when it is determined that needing to physical layer data When obtaining the target data, cache blocks corresponding to target data described in local cache are performed and concurrently judge to operate;
Data acquisition module, if showing to there is currently no the concurrently inquiry to the target data for operating result, The target data is inquired about to physical layer data;Otherwise, the current data in the cache blocks is returned as the target data.
The data query method and apparatus of the disclosure, concurrently judge to operate by performing when receiving inquiry request, can It is concurrent to determine whether to exist inquiry, so as in the absence of it is concurrent when just inquire about data to physical layer data, effectively prevent There is the phenomenon of caching breakdown.
Brief description of the drawings
Fig. 1 is the application scenarios for the data access that the embodiment of the present disclosure provides;
Fig. 2 is the flow chart for the data query that the embodiment of the present disclosure provides;
Fig. 3 is the flow chart for the data query that the embodiment of the present disclosure provides;
Fig. 4 is the flow chart for the data query method that the embodiment of the present disclosure provides;
Fig. 5 is the structural representation for the data query arrangement that the embodiment of the present disclosure provides.
Embodiment
Such as the application scenarios of a data access of Fig. 1 examples, user's data to be accessed are stored with database 11, are used Family can be by terminals such as PC, mobile devices, initiation data inquiry request, certain data in acquisition request database 11.Number It can be handled according to inquiry request by the request reception device 12 of example in Fig. 1, the request reception device 12 can be by database 11 The data of request are obtained, and return to request end.For example, the device can be in an equipment, receive and sent out in the equipment The multiple data inquiry requests risen;Or can also be in a plateform system, for receiving the number from multiple equipment According to inquiry request.
For faster response data inquiry request, " local cache " technology can be generally used, local cache is i.e. at this A part of space is marked off in the physical memory on ground and is used for buffered data, to improve response efficiency.For example, the request in Fig. 1 connects Receiving apparatus 12 can go database 11 to obtain number when receiving the inquiry request for certain data first by a thread According to and by the data storage in local cache, during in case receiving the request to same data again, directly from local acquisition Return, can so significantly improve the response efficiency to inquiry request.It is corresponding with local cache, the number of actual storage data Physical layer data is properly termed as according to storehouse 11, physical layer data 11 is the space of data persistence storage, for example, it may be data Storehouse.
In some scenes, because data are constantly to update, so the data being stored in local cache there are Imitate the time.Within effective time, request reception device 12 can obtain data directly from caching and return to request end;But work as When the data of local cache are expired, request reception device 12 needs to go physical layer data such as database 11 to obtain new number again According to update local cache.
It during data storage, is stored in cache blocks one by one in local cache to ask reception device 12, Each cache blocks can be a part of space of internal memory, and different cache blocks can store different pieces of information.It is slow with one Exemplified by counterfoil, the attribute of cache blocks can include:
Timer:Timer, the generation time for record buffer memory block;
Living Mill Seconds:The life span of cache blocks, in units of millisecond, in the life span, caching Data in block are effective, more than life span, it is necessary to obtain data renewal cache blocks by physical layer data;
Object:The data object stored in cache blocks.
Above three attribute, it is the attribute that a cache blocks generally have.In a follow-up exemplary field of the application Jing Zhong, in order to realize data query method described herein, the attribute of a cache blocks is added, specifically by follow-up example Described in son.
In the prior art, in the data query scene of above-mentioned Fig. 1 examples, it is possible that a kind of phenomenon, i.e., " caching is hit Wear ".Such as, it is assumed that there is an a data, the data in local cache are just expired, it is necessary to refresh, and now come just Largely the high frequency access queries of the data to be asked, then these a large amount of requests can all go physical layer data to obtain new data, The pressure moment of physical layer data is caused to rise violently, this phenomenon is referred to as caching breakdown.
It is not only the caching that above-mentioned data cached time-out is likely encountered when concurrently accessing to puncture, accesses certain data first When it is equally possible run into, such as, it is assumed that largely inquire about same data request reach request reception device 12, then request connect The request of each thread process one in receiving apparatus 12, local cache not no data during due to accessing first, these threads are all Database 11 can be gone to inquire about, cause the pressure moment of database 11 to rise violently, this is also a kind of caching punch-through.
Caching punch-through is larger by the pressure for causing physical layer data, and great prestige is formed to the stability of physical layer The side of body, a kind of data query method that the application provides, has been the above-mentioned caching breakdown problem of solution, to ensure physical layer data It is no longer influenced by the instantaneous pressure of mass data request.
First, the application describes lower the application's by taking above-mentioned " accessing first " and " caching time-out " two scenes as an example How method avoids caching from puncturing under both scenes;Certainly, both scenes are not limited in specific implementation, other classes As may cause caching puncture scene, this method can be used.
Access first:
In this example, it is assumed that the data storage in local cache, be that hash table is a kind of basis to hash sheet form storage The data structure that key value directly conducts interviews, Hash table is also, form of the data in hash table is key-value.Should In example, when inquiring about data, key can be carried in data inquiry request, the data of inquiry be the key corresponding to value, can So that the value inquired about is referred to as into target data.
Data query flow shown in Figure 2, following processing can be performed when accessing first:
In step 201, data inquiry request is received, key is carried in the request.
The request received in this step, it is therefore an objective to which inquiry obtains value corresponding to key.
In step 202, check in local cache, cache blocks corresponding to key, if for sky.
In this example, each key can correspond to a cache blocks, and the cache blocks are used to store value corresponding to key. Request reception device 12 first checks whether to deposit the data asked in step 201 in local cache.Because this example is to this The access first of data, so the cache blocks in the absence of the data.
In this step, the empty cache blocks of an acquiescence can be set, delayed as corresponding to the key asked when accessing first Counterfoil, it is now no data in the cache blocks, is sky.Otherwise, if cache blocks corresponding to a key in local cache It is not sky, then it is not the access first to data, will be described in other examples, this example is only described as branch's flow of sky (handling process when accessing first).
In step 203, attempt to pass through putIfAbsent methods, it is incoming to set value corresponding to key in cache blocks Value.
PutIfAbsent is a method in hash table, there is provided a kind of atom ability:Attempt to set a key-value pair (key-value) when, if data (value) are existing corresponding to key (key), it is not provided with, directly returns and be worth;It is no Then, data corresponding to key are arranged to incoming value, the incoming value can preset a data.
In this example, it is assumed that currently encountered and the substantial amounts of of same data is concurrently accessed, substantial amounts of inquiry request is same When will obtain same data, and the data still access first.In this case, ask reception device 12 will be right respectively Each data inquiry request uses a thread process, and each thread in multiple threads performs shown in Fig. 2 respectively Flow, each thread can judge that this is to access first, and cache blocks are sky, also, each thread will be tasted respectively It is incoming value to ping putIfAbsent methods and set value corresponding to key in cache blocks.
Assuming that one of thread is set successfully, i.e. this thread by putIfAbsent methods when being set, caching Value there is not yet corresponding to key in block, so value is set to incoming value by the thread;But when this thread is arranged to After work(, other threads all by setup failed because, other threads again by putIfAbsent methods attempt set when, cache blocks Value corresponding to middle key is present (the incoming value that thread i.e. above is set), then, other threads are just no longer set, and It is that direct return has been worth.
It can be seen that when multiple threads concurrently set same cache blocks data by putIfAbsent methods, only One can set success, and other threads all can setup failed.For single thread, the different knots of success or failure are set Fruit, different processing will be performed.Continuing with referring to Fig. 2, if configured to work(, continues executing with step 204 to 205, if set Failure, will continue executing with step 206.
In step 204, the target data is inquired about to physical layer data.
If thread putIfAbsent is set successfully, show to there is currently no the concurrently inquiry to target data, here Mean that before the thread not having other threads also goes physical layer data to inquire about same data, this thread is most fast line Journey.So, the thread can calls the inquiry service of registration, removes value corresponding to physical layer data inquiry key, and can be with Obtain the when effective life span of data.
In step 205, caching is stored data in.
This step can be by the data storage inquired about from physical layer data in local cache, and the existence of record buffer memory block Time, next time can be by directly returning in local cache.
The data got also are returned to inquiry request side by this step.
In step 206, the current data in the cache blocks is returned as the target data.
If thread putIfAbsent setup faileds, show to there is currently the concurrently inquiry to target data, the i.e. thread Before setting, there are other threads to go physical layer data to inquire about same data, now, the thread immediately returns to, and will be slow Current data in counterfoil as returned data, current data be before the incoming value that is set by putIfAbsent of thread.
It can see by the access process first of Fig. 2 flows, it is a large amount of concurrent when accessing same data first simultaneously, can be with These threads accessed of processing are set all to go putIfAbsent that same cache blocks are set, putIfAbsent methods are equivalent to one Kind tournament selection mechanism, a large amount of threads only have one can set success, go physical layer data to inquire about data;Also, according to The characteristics of putIfAbsent methods, if after a thread is set successfully, other threads all can setup failed, so as to set only Allow that successful thread to go to perform physical layer data inquiry, effectively prevent caching breakdown when accessing first.
Caching time-out:
This application scene can be that the step 202 in Fig. 2 is judging cache blocks not for branch's flow of space-time, wherein, such as During fruit data query, the cache blocks of local cache are not sky, then this is not the access first to data.In this case, can be with Handled according to the data query flow shown in Fig. 3:
In step 301, data inquiry request is received, key is carried in the request.
The request received in this step, it is therefore an objective to which inquiry obtains value corresponding to key.
In step 302, check in local cache, cache blocks corresponding to key, if for sky.
In this example, it is assumed that cache blocks are not sky, then perform step 303.
In step 303, judge whether cache blocks are expired.
As mentioned above, each cache blocks has a life span attribute, and the data in cache blocks are in life span Just effectively, physical layer data is needed to obtain the data after renewal when expired.
The judgement of this step, can be according to life span living the Mill Seconds, Yi Jiji in caching block's attribute When device timer, to determine whether life span overtime.If have not timed out, then the data of the cache blocks are still effective, perform Step 304;If had timed, out, step 305 is continued executing with.
In step 304, the current data in return cache block is as target data.
In step 305, judge whether cache blocks are updating.
In this example, also include in the attribute of the cache blocks:Update mark retrieving.The update mark includes two Kind state value:Very (true) and false (false), the true respresentation current cache block updates the data, i.e., current wired Journey goes physical layer data to obtain latest data, and the false expression current cache block does not update the data, although that is, cache blocks are Through expired, but there has been no thread to go physical layer data to obtain new data.
, can be according to above-mentioned update mark retrieving state when this step judges whether cache blocks update Value, if state value is true, updates, otherwise, if state value is false, does not update.
If a determination be made that cache blocks update, then step 304 is performed, that is, has had thread to go physical layer data to obtain Latest data is taken to update the cache blocks, so current thread is returned to, without going physical layer data to inquire about identical again Data.
If a determination be made that cache blocks not yet update, then step 306 is performed.
Within step 306, by without lock synchronous method, attempting to set the state of the update mark in the cache blocks Value is true.
For example, one kind can be CAS (Compare and Swap, relatively and exchange) without lock synchronous method.In this example, CAS operation can, if the update mark state value in the cache blocks is false, the state value is changed into true, It is now to set successfully;Otherwise, if the update mark state value in the cache blocks is not false, no longer set, this When represent setup failed.
In this step, it is assumed that it is expired in cache blocks and when not yet updating, currently encounter substantial amounts of concurrently access and all inquired about The data of the cache blocks, then according to Fig. 3 flow, multiple threads corresponding to these inquiry requests can all judge that cache blocks need Update, it is necessary to go physical layer data to obtain latest data, according to the flow of this example, above-mentioned multiple threads will all be attempted respectively The state value that the update mark of cache blocks is set by CAS methods is true.But only one of which thread is set successfully, That is, this thread by CAS methods when being set, the false that judges in the state value or step 305 of update mark, so The thread can set success, be set to true;But after this thread is set successfully, other threads pass through CAS again When method is attempted to set, because the state value of update mark has been modified into true, then setup failed.
It can be seen that when multiple threads concurrently set the update mark of same cache blocks by CAS methods, only one Individual to set success, other threads all can setup failed.For single thread, the different knots of success or failure are set Fruit, different processing will be performed.Continuing with referring to Fig. 3, if configured to work(, continues executing with step 307 to 309, if set Failure, will continue executing with step 304, data expired in cache blocks can be returned into inquiry request side.
In step 307, target data is inquired about to physical layer data.
In step 308, local cache is stored data in.
Value corresponding to the key inquired can be updated data expired in cache blocks in this step, and will Data return to inquiry request side.
In a step 309, it is false to recover the update mark.
In this example, after data are got by physical layer data, the state value of update mark is also reverted into false, Represent that current cache blocks no longer have updated.
It can see by Fig. 3 cache blocks timeout inquiries flow, largely concurrently inquiry is attempted to same cache blocks simultaneously Data renewal when, threads update mark for all going CAS to set the cache blocks of these inquiries of processing, CAS methods can be set A kind of tournament selection mechanism is also corresponded to, a large amount of threads only have one can set success, go physical layer data to inquire about data, and And as long as a thread sets successfully after, other threads all can setup failed, only allow that successful thread to go so as to set Physical layer data inquiry is performed, effectively prevent caching breakdown when time-out refreshes.
In addition, still by taking Fig. 1 scene as an example, the data inquiry request received by reception device 12 is asked, it may be possible to first The request of secondary access, it is also possible to which the flow of the request under cache blocks timeout case, i.e. Fig. 2 and Fig. 3 is all likely encountered, then should Device can integrate unified Fig. 2 and Fig. 3 processing, after receiving inquiry request, first judge whether is cache blocks in local cache Then it is to access first if sky for sky, can be according to Fig. 2 flow processings, if being not sky, right and wrong access first, can be with According to Fig. 3 flow processings.
From the point of view of the example of " accessing first " described above and " caching time-out " two scenes, whether PutIfAbsent, or CAS, the two methods have a feature, it would be possible to cause a large amount of concurrent requests of caching breakdown Each thread in thread, go perform one operation, this operation the characteristics of be that only a thread is operable to work(, Other threads are by operation failure;And it is just to operate successfully during in the absence of concurrent thread, operation failure when concurrent thread be present (for example be because having there is thread to perform operation in advance if putIfAbsent fails;Or if CAS fails, That is to have other threads to perform setting).According to These characteristics, it is believed that the operation performed by above-mentioned thread is one Kind of " concurrently judge operation ", according to the result of operation it is known that current with the presence or absence of concurrently inquiry, (for example if CAS loses Lose, then it represents that exist concurrent), and then decide whether to allow thread to go physical layer data to inquire about.
In other application scenarios, it can also be other behaviour outside putIfAbsen or CAS concurrently to judge operation Make, as long as above-mentioned operating function can be realized, the application concurrently judges to operate also with thread is performed into this, to determine With the presence or absence of concurrent, and then thread is controlled not go physical layer data to inquire about data in the presence of concurrent.Fig. 4 illustrates the application's Data query method, it can include:
In step 401, data inquiry request is received, the data inquiry request, which is used to inquire about, obtains target data.This The data that step will inquire about are referred to as target data, for example, value corresponding to key.
In step 402, target data is inquired about in local cache, when it is determined that needing to obtain number of targets to physical layer data According to when, to corresponding to target data described in local cache cache blocks perform concurrently judge operate.
In this example, if target data in local cache be present, then get data by local cache and return to and look into Requesting party is ask, is largely concurrently inquired about even if existing, and by locally responding, physical layer data will not be had an impact. But when the target data is not present in local cache, at this moment just needs physical layer data inquiry to obtain data, just have It is likely encountered foregoing caching breakdown problem.Here " it is determined that needing to obtain target data to physical layer data ", for example, can be with Cache blocks when accessing first for sky, so as to need to obtain data to physical layer data, or can also right and wrong access first When cache blocks time-out cause data failure, it is necessary to physical layer data obtain renewal data.
In step 403, if operating result shows to there is currently no the concurrently inquiry to the target data, to data Physical layer inquires about the target data;Otherwise, the current data in the cache blocks is returned as the target data.
The data query method of this example, concurrently judge to operate by performing when receiving inquiry request, it may be determined that It is current concurrent with the presence or absence of inquiry, so as in the absence of it is concurrent when just inquire about data to physical layer data, effectively prevent appearance Cache the phenomenon of breakdown.
In order to realize the above method, present invention also provides a kind of data query arrangement, as shown in figure 5, the device can be with Including:Request receiving module 51, buffer process module 52 and data acquisition module 53.
Request receiving module 51, for receiving data inquiry request, the data inquiry request, which is used to inquire about, obtains target Data;
Buffer process module 52, for inquiring about the target data in local cache, when it is determined that needing to data entity When layer obtains the target data, cache blocks corresponding to target data described in local cache are performed and concurrently judge to operate;
Data acquisition module 53, if showing to there is currently no the concurrently inquiry to the target data for operating result, Then the target data is inquired about to physical layer data;Otherwise, the current data in the cache blocks is returned as the number of targets According to.
In one example, it is described to determine to need to obtain the target data to physical layer data, be specially:The data Inquiry request is the inquiry first to target data, and cache blocks corresponding to the target data are sky.
In one example, the local cache uses key-value storage form, and the data inquiry request carries Key, the target data are value corresponding to the key;
The buffer process module 52, when concurrently judging operation for performing, including:In caching corresponding to the key In block, attempt to set value corresponding to the key by putIfAbsent as incoming value;
The data acquisition module 53, specifically for when the buffer process module is set successfully, then showing currently not In the presence of the concurrently inquiry to the target data, the target data is inquired about to physical layer data;Otherwise, in return cache block Current value corresponding to key, as the target data.
In one example, it is described to determine to need to obtain the target data to physical layer data, be specially:Local cache Described in cache blocks corresponding to target data it is expired, and the cache blocks not yet update.
In one example, the attribute of the cache blocks includes:Update mark, the update mark include two states Value:True and false, the true respresentation current cache block update the data, and the false expression current cache block does not update the data;
The buffer process module 52, when concurrently judging operation for performing, including:By without lock synchronous method, tasting It is true that examination, which sets the state value of the update mark in the cache blocks,;
The data acquisition module 53, specifically for when the buffer process module is set successfully, then showing currently not In the presence of the concurrently inquiry to the target data, and after the target data success is inquired about to physical layer data, described in recovery Update mark is false.
The device or module that above-described embodiment illustrates, can specifically be realized by computer chip or entity, or by with The product of certain function is realized.One kind typically realizes that equipment is computer, and the concrete form of computer can be personal meter Calculation machine, laptop computer, cell phone, camera phone, smart phone, personal digital assistant, media player, navigation are set It is any several in standby, E-mail receiver/send equipment, game console, tablet PC, wearable device or these equipment The combination of equipment.
For convenience of description, it is divided into various modules during description apparatus above with function to describe respectively.Certainly, this is being implemented The function of each module can be realized in same or multiple softwares and/or hardware when open.
The preferred embodiment of the disclosure is the foregoing is only, not limiting the disclosure, all essences in the disclosure God any modification, equivalent substitution and improvements done etc., should be included within the scope of disclosure protection with principle.

Claims (12)

  1. A kind of 1. data query method, it is characterised in that methods described includes:
    Data inquiry request is received, the data inquiry request, which is used to inquire about, obtains target data;
    The target data is inquired about in local cache, it is right when it is determined that needing to obtain the target data to physical layer data Cache blocks corresponding to target data described in local cache, which perform, concurrently judges operation;
    If operating result shows to there is currently no the concurrently inquiry to the target data, the mesh is inquired about to physical layer data Mark data;Otherwise, the current data in the cache blocks is returned as the target data.
  2. 2. according to the method for claim 1, it is characterised in that
    It is described to determine to need to obtain the target data to physical layer data, be specially:The data inquiry request is to described The inquiry first of target data.
  3. 3. according to the method for claim 2, it is characterised in that the local cache uses key-value storage form, The data inquiry request carries key, and the target data is value corresponding to the key;
    The execution concurrently judges operation, including:In cache blocks corresponding to the key, attempt to set by putIfAbsent Value corresponding to the key is incoming value;
    If setting successfully, show to there is currently no the concurrently inquiry to the target data;
    Otherwise, current value corresponding to the key in return cache block, as the target data.
  4. 4. according to the method for claim 1, it is characterised in that
    It is described to determine to need to obtain the target data to physical layer data, be specially:Target data pair described in local cache The cache blocks answered are expired, and the cache blocks not yet update.
  5. 5. according to the method for claim 4, it is characterised in that the attribute of the cache blocks includes:Update mark, it is described Update mark includes two states value:True and false, the true respresentation current cache block update the data, and the false expression is current Cache blocks do not update the data;
    The execution concurrently judges operation, including:By without lock synchronous method, attempting to set the renewal in the cache blocks The state value of mark is true;
    If setting successfully, show to there is currently no the concurrently inquiry to the target data, and inquire about to physical layer data After the target data success, it is false to recover the update mark.
  6. 6. according to the method for claim 5, it is characterised in that it is described without lock synchronous method, relatively and to exchange CAS.
  7. 7. according to the method for claim 5, it is characterised in that methods described also includes:
    If it is determined that cache blocks corresponding to the target data are expired, and the caching is determined according to the state value of the update mark Block updates, then returns to the current data in the cache blocks as the target data.
  8. 8. a kind of data query arrangement, it is characterised in that described device includes:
    Request receiving module, for receiving data inquiry request, the data inquiry request, which is used to inquire about, obtains target data;
    Buffer process module, for inquiring about the target data in local cache, when it is determined that needing to obtain to physical layer data During the target data, cache blocks corresponding to target data described in local cache are performed and concurrently judge to operate;
    Data acquisition module, if showing to there is currently no the concurrently inquiry to the target data for operating result, to number The target data is inquired about according to physical layer;Otherwise, the current data in the cache blocks is returned as the target data.
  9. 9. device according to claim 8, it is characterised in that described to determine to need to obtain the target to physical layer data Data, it is specially:The data inquiry request is the inquiry first to the target data.
  10. 10. device according to claim 9, it is characterised in that the local cache uses key-value storage shape Formula, the data inquiry request carry key, and the target data is value corresponding to the key;
    The buffer process module, when concurrently judging operation for performing, including:In cache blocks corresponding to the key, lead to It is incoming value to cross putIfAbsent and attempt to set value corresponding to the key;
    The data acquisition module, specifically for when the buffer process module is set successfully, then showing to there is currently no pair The concurrently inquiry of the target data, the target data is inquired about to physical layer data;Otherwise, key pairs in return cache block The current value answered, as the target data.
  11. 11. device according to claim 8, it is characterised in that described to determine to need to obtain the mesh to physical layer data Data are marked, are specially:Cache blocks are expired corresponding to target data described in local cache, and the cache blocks not yet update.
  12. 12. device according to claim 11, it is characterised in that the attribute of the cache blocks includes:Update mark, institute Stating update mark includes two states value:True and false, the true respresentation current cache block are updated the data, and the false expression is worked as Preceding cache blocks do not update the data;
    The buffer process module, when concurrently judging operation for performing, including:By without lock synchronous method, attempting to set The state value of the update mark in the cache blocks is true;
    The data acquisition module, specifically for when the buffer process module is set successfully, then showing to there is currently no pair The concurrently inquiry of the target data, and after the target data success is inquired about to physical layer data, recover the renewal mark It is designated as vacation.
CN201710245932.6A 2017-04-14 2017-04-14 Data query method and device Active CN107436910B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710245932.6A CN107436910B (en) 2017-04-14 2017-04-14 Data query method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710245932.6A CN107436910B (en) 2017-04-14 2017-04-14 Data query method and device

Publications (2)

Publication Number Publication Date
CN107436910A true CN107436910A (en) 2017-12-05
CN107436910B CN107436910B (en) 2020-08-18

Family

ID=60458976

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710245932.6A Active CN107436910B (en) 2017-04-14 2017-04-14 Data query method and device

Country Status (1)

Country Link
CN (1) CN107436910B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110113385A (en) * 2019-04-15 2019-08-09 中国平安人寿保险股份有限公司 Cache Dynamic Configuration, device, computer equipment and storage medium
CN110266799A (en) * 2019-06-21 2019-09-20 国网山西省电力公司忻州供电公司 A method of the idempotence based on caching is realized
CN110806943A (en) * 2019-09-16 2020-02-18 平安科技(深圳)有限公司 Data updating method based on updating mark and related equipment
CN111813792A (en) * 2020-06-22 2020-10-23 上海悦易网络信息技术有限公司 Method and equipment for updating cache data in distributed cache system
CN115361448A (en) * 2022-10-19 2022-11-18 北京挪拉斯坦特芬通信设备有限公司 Data processing method, HSS, electronic device and computer storage medium
CN116244216A (en) * 2023-03-17 2023-06-09 摩尔线程智能科技(北京)有限责任公司 Cache control method, device, cache line structure, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6442651B2 (en) * 1997-10-28 2002-08-27 Cacheflow, Inc. Shared cache parsing and pre-fetch
US20050240574A1 (en) * 2004-04-27 2005-10-27 International Business Machines Corporation Pre-fetching resources based on a resource lookup query
CN101090401A (en) * 2007-05-25 2007-12-19 金蝶软件(中国)有限公司 Data buffer store method and system at duster environment
CN102968507A (en) * 2012-12-14 2013-03-13 中国银行股份有限公司 Cache table based data query method
CN106453500A (en) * 2016-09-07 2017-02-22 努比亚技术有限公司 Cache generation and control method, cache server and interface server

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6442651B2 (en) * 1997-10-28 2002-08-27 Cacheflow, Inc. Shared cache parsing and pre-fetch
US20050240574A1 (en) * 2004-04-27 2005-10-27 International Business Machines Corporation Pre-fetching resources based on a resource lookup query
CN101090401A (en) * 2007-05-25 2007-12-19 金蝶软件(中国)有限公司 Data buffer store method and system at duster environment
CN102968507A (en) * 2012-12-14 2013-03-13 中国银行股份有限公司 Cache table based data query method
CN106453500A (en) * 2016-09-07 2017-02-22 努比亚技术有限公司 Cache generation and control method, cache server and interface server

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
ARTHYRKINGYS: ""常见性能优化策略的总结"", 《CSDN- HTTPS://BLOG.CSDN.NET/U011001084/ARTICLE/DETAILS/53464550》 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110113385A (en) * 2019-04-15 2019-08-09 中国平安人寿保险股份有限公司 Cache Dynamic Configuration, device, computer equipment and storage medium
CN110266799A (en) * 2019-06-21 2019-09-20 国网山西省电力公司忻州供电公司 A method of the idempotence based on caching is realized
CN110806943A (en) * 2019-09-16 2020-02-18 平安科技(深圳)有限公司 Data updating method based on updating mark and related equipment
CN111813792A (en) * 2020-06-22 2020-10-23 上海悦易网络信息技术有限公司 Method and equipment for updating cache data in distributed cache system
CN115361448A (en) * 2022-10-19 2022-11-18 北京挪拉斯坦特芬通信设备有限公司 Data processing method, HSS, electronic device and computer storage medium
CN116244216A (en) * 2023-03-17 2023-06-09 摩尔线程智能科技(北京)有限责任公司 Cache control method, device, cache line structure, electronic equipment and storage medium
CN116244216B (en) * 2023-03-17 2024-03-01 摩尔线程智能科技(北京)有限责任公司 Cache control method, device, cache line structure, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN107436910B (en) 2020-08-18

Similar Documents

Publication Publication Date Title
CN107436910A (en) A kind of data query method and apparatus
CN102682037B (en) A kind of data capture method, system and device
CN103873451B (en) A kind of method, apparatus and system of data syn-chronization
CN105224255B (en) A kind of storage file management method and device
CN106790629A (en) Data synchronization unit and its realize the method for data syn-chronization, client access system
US9590947B2 (en) IP management method, client and server
CN105681397A (en) Network traffic data storage method and system, query method and device
CN104133728B (en) Method and device for communication between processes
CN105357271B (en) A kind of information processing method and corresponding intrument
US20200036812A1 (en) Resource Download Method, Electronic Device, and Apparatus
CN105939355A (en) Data access method and system, as well as client and server
CN110197075A (en) Resource access method, calculates equipment and storage medium at device
CN106021126A (en) Cache data processing method, server and configuration device
CN109936639A (en) A kind of service calling method and server
US20130111142A1 (en) Method for accessing cache and pseudo cache agent
CN106326293A (en) Access method and device based on dynamic webpage
CN110581784B (en) Node health check method, device and equipment
CN111224829A (en) Method and device for accessing external node to block chain network, and block chain network
CN113938464A (en) Access request method and terminal
CN109062717A (en) Data buffer storage and caching disaster recovery method and system, caching system
CN111061654B (en) Cache refreshing processing method and device and electronic equipment
CN105868210A (en) Creating method and device of unique index in distributed database
EP1648138A1 (en) Method and system for caching directory services
CN103902469B (en) A kind of method and system of data pre-fetching
CN115114311A (en) Transaction execution method and related 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
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20200924

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee after: Innovative advanced technology Co.,Ltd.

Address before: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee before: Advanced innovation technology Co.,Ltd.

Effective date of registration: 20200924

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee after: Advanced innovation technology Co.,Ltd.

Address before: A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands

Patentee before: Alibaba Group Holding Ltd.

TR01 Transfer of patent right