CN106372156A - Data caching method and system - Google Patents

Data caching method and system Download PDF

Info

Publication number
CN106372156A
CN106372156A CN201610771018.0A CN201610771018A CN106372156A CN 106372156 A CN106372156 A CN 106372156A CN 201610771018 A CN201610771018 A CN 201610771018A CN 106372156 A CN106372156 A CN 106372156A
Authority
CN
China
Prior art keywords
data
unit interval
period
inquiry
cache
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
Application number
CN201610771018.0A
Other languages
Chinese (zh)
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.)
Fujian TQ Digital Co Ltd
Original Assignee
Fujian TQ Digital Co 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 Fujian TQ Digital Co Ltd filed Critical Fujian TQ Digital Co Ltd
Priority to CN201610771018.0A priority Critical patent/CN106372156A/en
Publication of CN106372156A publication Critical patent/CN106372156A/en
Pending legal-status Critical Current

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

Abstract

The invention provides a data caching method and system. The method comprises the following steps: presetting a first cycle, and dividing the first cycle into more than two first unit time slots; recording identification and searching time of a data searching record; calculating the searching times of each data in the first cycle in the first unit time slots of the first cycle according to the identification and searching time; acquiring searching record identification with the most searching times in the first unit time slots of the first cycle according to the calculation result; and loading a first preset number of data with the most searching times in the unit time slots in the first cycle corresponding to the current time into cache according to the identification. During current searching, the data with the most searching times in the first unit time slots in the last first cycle corresponding to the current time is loaded into cache, and the system has the advantage of improving the hit rate of cache to a great extent by utilizing relatively small cache space.

Description

Data cache method and system
Technical field
The present invention relates to field of computer technology, more particularly, to a kind of data cache method and system.
Background technology
When receiving inquiry request of data, current method is all directly will to meet the data of querying condition from data base It is loaded in caching, if so data is all loaded in caching, when data volume is excessive, caching cannot carry, if It is low that the data loading not is easily caused Hit ratio again.
The Chinese patent of Publication No. cn 104123243 a proposes a kind of data buffering system and method, wherein method Including step: receive the reading request of data that cpu sends;Read corresponding data according to reading request of data;And in cache life When middle, the weighted value of the data reading in buffer memory is added 1, when the space of buffer memory is full, being in weighted value is zero Data next time need to carry out buffer memory replace when be selected at random some being replaced.
But such scheme is first data to be stored in buffer memory, buffer memory has been expired ability and has been replaced data low for weight Change, caching takies and is in higher state all the time, and hit rate is also than relatively low.
Content of the invention
The technical problem to be solved is: a kind of data cache method and system are provided, can be using less In the case of spatial cache, improve the hit rate of caching.
In order to solve above-mentioned technical problem, the technical solution used in the present invention is:
A kind of data cache method, comprising:
The default period 1, and the described period 1 be divided into plural first unit interval;
The mark of record data inquiry record and the query time of data query record;
Identify the first list in the described period 1 with every data in query time one period 1 of statistics according to described Inquiry times in the time period of position;
Obtain the most inquiry record of inquiry times in first unit interval of described period 1 according to statistical result Mark;
According in the described period 1 that described mark loads the first default number of branches during the first unit of corresponding current time Between in section the most data of inquiry times in cache.
Another technical scheme of the present invention is:
A kind of data buffering system, comprising:
Setup module, for presetting the period 1, and when the described period 1 is divided into plural first unit Between section;
Logging modle, the mark for record data inquiry record and the query time of data query record;
Statistical module, for counting in the period 1 every data described first according to described mark and query time Inquiry times in first unit interval in cycle;
Computing module, for obtaining in first unit interval of described period 1 inquiry times according to statistical result The mark of many inquiry records;
Load-on module, for corresponding current time in the described period 1 according to described mark loading the first default number of branches The first unit interval in the most data of inquiry times to cache in.
The beneficial effects of the present invention is: record is inquired about by statistical data, history period 1 Nei Ge can be learnt The most data of inquiry times in one unit interval, i.e. hit rate highest data, therefore, during current queries, by upper 1 In first unit interval of corresponding current time in one cycle, the most data of inquiry times is loaded onto in caching, is different from existing By the method for all data buffer storages in technology, have and can largely improve caching using less spatial cache The advantage of hit rate.
Brief description
Fig. 1 is the flow chart of the data cache method of the embodiment of the present invention;
Fig. 2 is the structural representation of the data buffering system of the embodiment of the present invention;
Fig. 3 is the flow chart of the data cache method of the embodiment of the present invention one.
Label declaration:
1st, setup module;2nd, logging modle;3rd, statistical module;4th, computing module;5th, load-on module.
Specific embodiment
By describing the technology contents of the present invention in detail, being realized purpose and effect, below in conjunction with embodiment and coordinate attached Figure is explained.
The design of most critical of the present invention is: looked in the time period of current time corresponding in the upper cycle during current queries Ask the most data of number of times to be loaded onto in caching.
Refer to Fig. 1, the present invention provides:
A kind of data cache method, comprising:
The default period 1, and the described period 1 be divided into plural first unit interval;
The mark of record data inquiry record and the query time of data query record;
Identify the first list in the described period 1 with every data in query time one period 1 of statistics according to described Inquiry times in the time period of position;
Obtain the most inquiry record of inquiry times in first unit interval of described period 1 according to statistical result Mark;
According in the described period 1 that described mark loads the first default number of branches during the first unit of corresponding current time Between in section the most data of inquiry times in cache.
Knowable to foregoing description, the having the beneficial effects that of data cache method of the present invention: according to history week during current queries By data buffer storages most for corresponding inquiry times, spatial cache takies less, shoots straight the inquiry record of phase.
Further, the of corresponding current time in the described period 1 loading the first default number of branches according to described mark In one unit interval, the most data of inquiry times, in cache, further includes afterwards:
Default first unit interval is second round, when described second round is divided into plural second unit Between section, statistics obtain inquiry times in each second unit interval in the second round most inquiry record mark;
According in the described second round that described mark loads the second default number of branches during the second unit of corresponding current time Between in section the most data of inquiry times in cache.
Knowable to foregoing description, also can above-mentioned first unit interval be continued to be divided into the less time period, according to same The method of sample carries out counting the inquiry times in the respectively less time period, and will correspond to inquiry in the time period after the same method The most data of number of times enters row cache, and cache resources are divided at least two parts, and a part stores this first unit interval The most data of inquiry times in section, the most data of inquiry times in a part this second unit interval of storage, such as one What in it, inquiry times were most is a data, and two inquiries in nearest a hour are b data, then next inquire about the possibility of b data Property also very high, therefore, by b data buffer storage, so data cached according to currently specific request for information, further increase hit Rate.
Further, the described period 1 is a week, and described first unit interval is one day, the second unit interval For one hour.
Knowable to foregoing description, it is the selection of one specific embodiment of the present invention using one day and a week as cycle, It can also be provided that other times.
Further, described first default number of branches and the summation of the second default number of branches are less than or equal to available spatial cache Maximum.
Knowable to foregoing description, the first default number of branches and the second default number of branches may be the same or different, with specific reference to reality Needs are configured, without departing from the maximum of spatial cache.
Further, described first default number of branches is less than or equal to the maximum of available spatial cache.
Refer to Fig. 2, another technical scheme of the present invention is:
A kind of data buffering system, comprising:
Setup module 1, for presetting the period 1, and when the described period 1 is divided into plural first unit Between section;
Logging modle 2, the mark for record data inquiry record and the query time of data query record;
Statistical module 3, for counting in the period 1 every data described the according to described mark and query time Inquiry times in first unit interval in one cycle;
Computing module 4, for obtaining inquiry times in first unit interval of described period 1 according to statistical result The mark of most inquiry records;
Load-on module 5, during for corresponding to current in the described period 1 according to described mark loading the first default number of branches Between the first unit interval in the most data of inquiry times to cache in.
Knowable to foregoing description, the having the beneficial effects that of data buffering system of the present invention: setup module setting period 1 And the period 1 is divided, the request for information of logging modle record data, thus can be counted by statistical module obtain The inquiry times of every data in each first unit interval in period 1, be can get each first by computing module The most data of inquiry times in unit interval, thus will be corresponding current in the upper period 1 when load-on module is loaded The data that the first unit interval inquiry times of time are most is loaded onto in caching, has both decreased cache occupation amount, improves again Cache hit rate.
Further, described setup module 1 is additionally operable to default first unit interval is second round, by described second week Phase is divided into plural second unit interval;Described statistical module 3 is additionally operable to according to described mark and query time system Count every data in the second round and obtain one in the inquiry times statistics in second unit interval of described second round The mark of the most inquiry record of inquiry times in the second unit interval in second round;Described computing module 4 is additionally operable to Obtain the mark of the most inquiry record of inquiry times in second unit interval of described second round according to statistical result;
Described load-on module 5 is additionally operable in the described second round loading the second default number of branches according to described mark to should In second unit interval of front time, the most data of inquiry times is in cache.
Knowable to foregoing description, also can be united by the same way after the first unit interval is continued to divide Meter, data is loaded onto in caching the result that then load-on module foundation counts, and further increases the hit rate of caching.
Further, the described period 1 is a week, and described first unit interval is one day, the second unit interval For one hour.
Further, described first default number of branches and the summation of the second default number of branches are less than or equal to available spatial cache Maximum.
Further, described first default number of branches is less than or equal to the maximum of available spatial cache.
Refer to Fig. 3, embodiments of the invention one are:
A kind of data cache method, comprising:
The default period 1, and the described period 1 be divided into plural first unit interval;Specifically, institute State the period 1 for a week, described first unit interval is one day;
The mark of record data inquiry record and the query time of data query record;
Identify the first list in the described period 1 with every data in query time one period 1 of statistics according to described Inquiry times in the time period of position;
Obtain the most inquiry record of inquiry times in first unit interval of described period 1 according to statistical result Mark;
According in the described period 1 that described mark loads the first default number of branches during the first unit of corresponding current time Between in section the most data of inquiry times in cache;
Default first unit interval is second round, when described second round is divided into plural second unit Between section, statistics obtain inquiry times in each second unit interval in the second round most inquiry record mark;Specifically , described second unit interval is one hour;
According in the described second round that described mark loads the second default number of branches during the second unit of corresponding current time Between in section the most data of inquiry times in cache;Described first default number of branches is less than or equal to the second default number of branches sum The maximum of available cache memory.
It is emphasized that in such scheme, presetting the first unit interval is second round, and described second round is drawn The step being divided into the second at least two unit interval, with predetermined period and can divide the step in cycle and carry out simultaneously, Count inquiry times in each second unit interval most inquiry record mark step can with count each first unit when Between in section the step of the most mark of inquiry record of inquiry times carry out simultaneously.
Below the scheme in above-described embodiment one is illustrated with a specific example:
The idling-resource of hypothesis server is 10000 data, and in data base, total a-j ten data, records each My god, horal data query record identification and query time, statistically in the week each data daily inquiry times, Obtain the mark of the most inquiry record of daily inquiry times, thus obtaining the most data of daily inquiry times and the same day Time, what such as Monday inquiry times were most is data a, and what Tuesday inquiry times were most is data b, during this inquiry, Assume that current time is Monday, then data a is loaded onto in caching.Also can be to the data query of each of the previous day hour Number is counted it is assumed that current time is at 12 points, and data c at most, is then loaded onto slow by the number of times that the previous day 12 point data c loads In depositing.Wherein, the data strip number being loaded with week for the cycle is 5000, and the data strip number being loaded for the cycle with sky is also for 5000 Bar.
Refer to Fig. 2, embodiments of the invention two are:
A kind of data buffering system, comprising:
Setup module 1, for presetting the period 1, and when the described period 1 is divided into plural first unit Between section;Default first unit interval is second round, and described second round is divided into plural second unit interval Section;The described period 1 is a week, and the first unit interval is one day, and the second unit interval is one hour;
Logging modle 2, the mark for record data inquiry record and the query time of data query record;
Statistical module 3, for counting in the period 1 every data each first according to described mark and query time Inquiry times in unit interval;Count in the second round every data according to described mark and query time each second Inquiry times in unit interval;
Computing module 4, for obtaining inquiry times in first unit interval of described period 1 according to statistical result The mark of most inquiry records;Obtain in second unit interval of described second round inquiry times according to statistical result The mark of many inquiry records;
Load-on module 5, during for corresponding to current in the described period 1 according to described mark loading the first default number of branches Between the first unit interval in the most data of inquiry times to cache in;And load the second default bar according to described mark In second unit interval of corresponding current time in the described period 1 of number, the most data of inquiry times is in cache;Institute State the first default number of branches and the second default number of branches sum is less than or equal to the maximum in available cache memory space.
In sum, what the present invention provided can by inquiry times in the time period of current time corresponding in history cycle Many data buffer storages, and less unit interval in unit interval is analyzed, the number of the corresponding unit interval of caching According to, rather than as prior art directly caches so data, therefore have the advantages that caching occupancy is little, shoot straight.
The foregoing is only embodiments of the invention, not thereby limit the present invention the scope of the claims, every using this The equivalents that bright description and accompanying drawing content are made, or directly or indirectly it is used in the technical field of correlation, all include in the same manner In the scope of patent protection of the present invention.

Claims (10)

1. a kind of data cache method is it is characterised in that include:
The default period 1, and the described period 1 be divided into plural first unit interval;
The mark of record data inquiry record and the query time of data query record;
Identify with every data in query time one period 1 of statistics in first unit of described period 1 according to described Between inquiry times in section;
Obtain the mark of the most inquiry record of inquiry times in first unit interval of described period 1 according to statistical result Know;
The first unit interval according to current time corresponding in the described period 1 that described mark loads the first default number of branches The most data of interior inquiry times is in cache.
2. data cache method according to claim 1 is it is characterised in that load the first default number of branches according to described mark A upper cycle in corresponding current time the first unit interval in the most data of inquiry times in cache, laggard one Step includes:
Default first unit interval is second round, and described second round is divided into plural second unit interval Section, statistics obtains the mark of the most inquiry record of inquiry times in each second unit interval in the second round;
The second unit interval according to current time corresponding in the described second round that described mark loads the second default number of branches The most data of interior inquiry times is in cache.
3. data cache method according to claim 2 is it is characterised in that the described period 1 is a week, described the One unit interval is one day, and the second unit interval is one hour.
4. data cache method according to claim 2 is it is characterised in that described first default number of branches presets bar with second The summation of number is less than or equal to the maximum of available spatial cache.
5. data cache method according to claim 1 it is characterised in that described first default number of branches be less than or equal to can The maximum of spatial cache.
6. a kind of data buffering system is it is characterised in that include:
Setup module, for presetting the period 1, and the described period 1 is divided into plural first unit interval;
Logging modle, the mark for record data inquiry record and the query time of data query record;
Statistical module, for identifying with every data in query time one period 1 of statistics in the described period 1 according to described The first unit interval in inquiry times;
Computing module, most for obtaining inquiry times in first unit interval of described period 1 according to statistical result The mark of inquiry record;
Load-on module, for load the first default number of branches according to described mark the described period 1 in corresponding current time the In one unit interval, the most data of inquiry times is in cache.
7. data buffering system according to claim 6 is it is characterised in that described setup module is additionally operable to default first list The position time period is second round, and described second round is divided into plural second unit interval;Described statistical module It is additionally operable to identify the second unit in described second round with every data in query time one second round of statistics according to described Inquiry times in time period count the most inquiry of inquiry times in the second unit interval obtaining in the second round The mark of record;Described computing module is additionally operable to obtain looking in second unit interval of described second round according to statistical result Ask the mark of the most inquiry record of number of times;
When described load-on module is additionally operable to corresponding current in the described second round according to described mark loading the second default number of branches Between the second unit interval in the most data of inquiry times to cache in.
8. data buffering system according to claim 7 is it is characterised in that the described period 1 is a week, described the One unit interval is one day, and the second unit interval is one hour.
9. data buffering system according to claim 7 is it is characterised in that described first default number of branches presets bar with second The summation of number is less than or equal to the maximum of available spatial cache.
10. data buffering system according to claim 6 is it is characterised in that described first default number of branches is less than or equal to The maximum of available spatial cache.
CN201610771018.0A 2016-08-30 2016-08-30 Data caching method and system Pending CN106372156A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610771018.0A CN106372156A (en) 2016-08-30 2016-08-30 Data caching method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610771018.0A CN106372156A (en) 2016-08-30 2016-08-30 Data caching method and system

Publications (1)

Publication Number Publication Date
CN106372156A true CN106372156A (en) 2017-02-01

Family

ID=57901718

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610771018.0A Pending CN106372156A (en) 2016-08-30 2016-08-30 Data caching method and system

Country Status (1)

Country Link
CN (1) CN106372156A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108984553A (en) * 2017-06-01 2018-12-11 北京京东尚科信息技术有限公司 Caching method and device
WO2019141134A1 (en) * 2018-01-19 2019-07-25 阿里巴巴集团控股有限公司 Data query method, apparatus and device
CN113139002A (en) * 2020-01-19 2021-07-20 上海静客网络科技有限公司 Hot spot data caching method based on Redis

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103139278A (en) * 2011-12-05 2013-06-05 北京网康科技有限公司 Network resource pre-fetching and cache accelerating method and device thereof
CN103177005A (en) * 2011-12-21 2013-06-26 深圳市腾讯计算机系统有限公司 Processing method and system of data access
US8495056B2 (en) * 2009-09-21 2013-07-23 At&T Intellectual Property I, L.P. System and method for caching database reports
CN104123243A (en) * 2013-04-24 2014-10-29 鸿富锦精密工业(深圳)有限公司 Data caching system and method
CN104715020A (en) * 2015-02-13 2015-06-17 腾讯科技(深圳)有限公司 Cache data deleting method and server

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8495056B2 (en) * 2009-09-21 2013-07-23 At&T Intellectual Property I, L.P. System and method for caching database reports
CN103139278A (en) * 2011-12-05 2013-06-05 北京网康科技有限公司 Network resource pre-fetching and cache accelerating method and device thereof
CN103177005A (en) * 2011-12-21 2013-06-26 深圳市腾讯计算机系统有限公司 Processing method and system of data access
CN104123243A (en) * 2013-04-24 2014-10-29 鸿富锦精密工业(深圳)有限公司 Data caching system and method
CN104715020A (en) * 2015-02-13 2015-06-17 腾讯科技(深圳)有限公司 Cache data deleting method and server

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108984553A (en) * 2017-06-01 2018-12-11 北京京东尚科信息技术有限公司 Caching method and device
CN108984553B (en) * 2017-06-01 2022-02-01 北京京东尚科信息技术有限公司 Caching method and device
WO2019141134A1 (en) * 2018-01-19 2019-07-25 阿里巴巴集团控股有限公司 Data query method, apparatus and device
US11734271B2 (en) 2018-01-19 2023-08-22 Alibaba Group Holding Limited Data query method, apparatus and device
CN113139002A (en) * 2020-01-19 2021-07-20 上海静客网络科技有限公司 Hot spot data caching method based on Redis

Similar Documents

Publication Publication Date Title
CN103577440B (en) A kind of data processing method and device in non-relational database
US9792310B2 (en) Run index compression
CN107644071A (en) Buffering updating method, device and data-storage system
CN106202581B (en) A kind of data search method and device
CN104281582B (en) Pagination Display control method and device
CN106372156A (en) Data caching method and system
CN110825733B (en) Multi-sampling-stream-oriented time series data management method and system
US20180329921A1 (en) Method and apparatus for storing time series data
CN102867071A (en) Management method for massive network management historical data
CN106528787A (en) Mass data multi-dimensional analysis-based query method and device
CN104699422A (en) Determination method and determination device of cache data
CN110381151A (en) A kind of warping apparatus detection method and device
CN106649828A (en) Data query method and system
CN104111898A (en) Hybrid storage system based on multidimensional data similarity and data management method
JP2015530666A (en) Data indexing method and apparatus
WO2001029715A3 (en) Database for electronic design automation applications
CN104679884B (en) Data analysing method, device and the system of database
CN109165096A (en) The caching of web cluster utilizes system and method
CN110147345A (en) A kind of key assignments storage system and its working method based on RDMA
CN105989072B (en) Non-repetition counting method and equipment
CN109614270A (en) Data read-write method, device, equipment and storage medium based on Hbase
CN115408149A (en) Time sequence storage engine memory design and distribution method and device
AU2018354550A1 (en) Systems and methods for intelligently grouping financial product users into cohesive cohorts
CN116339986A (en) Parallel computing method for characteristic peak similarity analysis algorithm of nuclear magnetic spectrum diagram
CN102081624B (en) Data inquiring method and data inquiring device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20170201

RJ01 Rejection of invention patent application after publication