CN110362505A - A method of caching is written and read using caching blocker - Google Patents

A method of caching is written and read using caching blocker Download PDF

Info

Publication number
CN110362505A
CN110362505A CN201910619472.8A CN201910619472A CN110362505A CN 110362505 A CN110362505 A CN 110362505A CN 201910619472 A CN201910619472 A CN 201910619472A CN 110362505 A CN110362505 A CN 110362505A
Authority
CN
China
Prior art keywords
caching
index
blocker
read
written
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
CN201910619472.8A
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.)
Zheng Wei Yun Ltd
Original Assignee
Zheng Wei Yun 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 Zheng Wei Yun Ltd filed Critical Zheng Wei Yun Ltd
Priority to CN201910619472.8A priority Critical patent/CN110362505A/en
Publication of CN110362505A publication Critical patent/CN110362505A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0806Multiuser, multiprocessor or multiprocessing cache systems
    • G06F12/0842Multiuser, multiprocessor or multiprocessing cache systems for multiprocessing or multitasking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0877Cache access modes

Abstract

The invention discloses a kind of methods for being written and read caching using caching blocker, the following steps are included: user initiates to obtain the request of business datum, if being provided with caching marker above the processing method A of user's request, blocker interception can be buffered, method A can be marked in caching marker, and system this method is told to need using caching.Developer need to only be absorbed in writing for service code when the present invention caches, without paying close attention to the read-write of caching, without being implanted into read-write cache code in service code, size of code can be reduced in this way, improve the development efficiency of developer, and only need in caching blocker the read-write written in code that once be cached, can Anywhere use in system, reach the effect of " once writing, can be used everywhere ".

Description

A method of caching is written and read using caching blocker
Technical field
The present invention relates to read-write cache technical field more particularly to a kind of sides that caching is written and read using caching blocker Method.
Background technique
When developer is using caching, developer must write the code of read-write cache in service code, this The usage mode of caching will lead in service code there are the code of a large amount of repetitive read-writes caching, while also improve answering for system Polygamy reduces code readability, and make developer can not 100% energy be absorbed in during service code writes.
Summary of the invention
The purpose of the present invention is to solve disadvantages existing in the prior art, and propose a kind of using caching blocker The method for being written and read caching.
To achieve the goals above, present invention employs following technical solutions: a kind of to be written and read using caching blocker The method of caching, comprising the following steps:
SS01: user initiates to obtain the request of business datum;
SS02: if being provided with caching marker above the processing method A of user's request, blocker can be buffered and blocked It cuts, method A can be marked in caching marker, and system this method is told to need using caching;Then system is in initialization When, all methods for indicating cache tag can be recorded in which in caching method list, i.e., method A can be recorded to caching side In method list, when system operation, the processing method A that system detection to user is requested is included in caching method list In, caching blocker can be intercepted to being present in all methods in caching method list, and final the method A is prior The caching blocker set intercepts;
SS03: after caching blocker intercepts the request of user, according to the index field of index setter setting, from rope Cause middle construction caching index of growing up to be a useful person;
SS04: the caching that index maker is obtained from caching indexes corresponding business datum;
SS05: if data cached is not sky, as hit is cached, and directly returns data to user;
SS06: if data cached to be empty, as miss is cached, and calls business datum to obtain interface, interface is returned Data are arranged according to the caching index obtained into caching in caching blocker;
SS07: final service data are returned to user.
It is as above-mentioned technical proposal to further describe:
The major function of the caching blocker is according to explaining after identifier approach intercepts to indicating, according to slow The value for depositing index setter setting, preferentially obtains data, if there is data are then directly returned from caching;If without data, Business datum is obtained from interface, and is indexed according to caching, and business datum is arranged into caching.
It is as above-mentioned technical proposal to further describe:
The major function of the caching marker is that setting needs the method for carrying out data buffer storage to stamp mark, and is arranged slow The expired time deposited, beating calibration method by this marker will be intercepted by above-mentioned caching blocker.
It is as above-mentioned technical proposal to further describe:
The index setter is the handling implement of setting caching index, and the major function for indexing setter is that setting is slow Index is deposited, the major function of the index maker is given birth to according to the setting value of index setter, and with certain index rule At the caching index being finally written and read.
It is as above-mentioned technical proposal to further describe:
The buffered marker beats calibration method after the interception of buffered blocker, according to the setting of index setter And generated and indexed by index maker, it is postponed according to the index and is written and read data in warehousing, wherein caching library is for saving It is data cached.
It is as above-mentioned technical proposal to further describe:
The premise that index setter can come into force in the step 3 has been stamped using caching marker slow for some method M The label deposited, and index maker will carry out caching index construction with certain rule, wherein index setter is stamping caching The setting specifically indexed on certain several method parameter of the method M of label, the ginseng as in method M included address name Number can then add index setting in the parameter.
It is as above-mentioned technical proposal to further describe:
The index rule of the index maker includes four kinds altogether, wherein the first index rule are as follows: to index setter The value of setting is prefix, and method parameter actual value is suffix, intermediate with the segmentation of English colon.
It is as above-mentioned technical proposal to further describe:
Second of index rule are as follows: if the index not set any value of setter, for default setting, in method M The title and value of all parameters are all added in caching index as a part of content, intermediate with the segmentation of English colon.
It is as above-mentioned technical proposal to further describe:
The third described index rule are as follows: if index setter is arranged in a composite object parameter, and the object Each attribute both provide accessor method, by need cover caching index one or more attribute-names, by each category Property name cover in English double quotation marks, it is intermediate simultaneously to be divided with comma;
It is set a property entitled prefix with indexing setter, passes through the correspondence attribute value that composite object accessor method obtains It is intermediate with the segmentation of English colon for suffix.
It is as above-mentioned technical proposal to further describe:
The 4th kind of index rule is to carry out after adding using current system local environment alias and systematic name as prefix The generation of final caching index.
Beneficial effect
The present invention provides a kind of methods for being written and read caching using caching blocker.Have it is following the utility model has the advantages that
Developer need to only be absorbed in business generation when this is cached using the method that caching blocker is written and read caching Code is write, and without paying close attention to the read-write of caching, is not necessarily to be implanted into read-write cache code in service code, can reduce code in this way Amount, improves the development efficiency of developer, and the read-write written in code that only need to be once cached in caching blocker, is It can Anywhere be used in system, reach the effect of " once writing, can be used everywhere ".
Detailed description of the invention
Fig. 1 is a kind of flow chart of method that caching is written and read using caching blocker proposed by the present invention;
Fig. 2 is a kind of swim-lane diagram of method that caching is written and read using caching blocker proposed by the present invention;
Fig. 3 is caching component relational graph in the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.
Referring to Fig.1-3, a method of being written and read caching using caching blocker, comprising the following steps:
SS01: user initiates to obtain the request of business datum;
SS02: if being provided with caching marker above the processing method A of user's request, blocker can be buffered and blocked It cuts, method A can be marked in caching marker, and system this method is told to need using caching;Then system is in initialization When, all methods for indicating cache tag can be recorded in which in caching method list, i.e., method A can be recorded to caching side In method list, when system operation, the processing method A that system detection to user is requested is included in caching method list In, caching blocker can be intercepted to being present in all methods in caching method list, and final the method A is prior The caching blocker set intercepts;
SS03: after caching blocker intercepts the request of user, according to the index field of index setter setting, from rope Cause middle construction caching index of growing up to be a useful person;
SS04: the caching that index maker is obtained from caching indexes corresponding business datum;
SS05: if data cached is not sky, as hit is cached, and directly returns data to user;
SS06: if data cached to be empty, as miss is cached, and calls business datum to obtain interface, interface is returned Data are arranged according to the caching index obtained into caching in caching blocker;
SS07: final service data are returned to user.
The major function of caching blocker is according to explaining after identifier approach intercepts to indicating, according to caching rope The value for drawing setter setting, preferentially obtains data, if there is data are then directly returned from caching;If without data, from connecing Business datum is obtained in mouthful, and is indexed according to caching, and business datum is arranged into caching.
Third party library or programming language can also be used to carry the exploitation that blocker carries out caching blocker.
The major function of caching marker is that setting needs the method for carrying out data buffer storage to stamp mark, and caching is arranged Expired time, beating calibration method by this marker will be intercepted by above-mentioned caching blocker.
Index setter is the handling implement of setting caching index, and the major function for indexing setter is setting caching rope Draw, the major function of index maker be according to the setting value of index setter, and with certain index rule generate finally into The caching index of row read-write.
Configuration file or the included function of explaining of language can also be used to carry out caching marker and index the reality of setter It is existing.
Be buffered marker beat calibration method, be buffered blocker intercept after, according to index setter setting and by Index maker generates index, is postponed according to the index and is written and read data in warehousing, wherein caching library is to cache for saving Data.
Non-relational database can also be used or use native virtual machine memory as caching library.
It is that some method M stamps caching using caching marker that the premise that setter can come into force is indexed in step 3 Label, and index maker will carry out caching index construction with certain rule, wherein index setter is stamping cache tag Method M certain several method parameter on the setting that is specifically indexed, the parameter as in method M included address name, then Index setting can be added in the parameter.
The index rule of index maker includes four kinds altogether, wherein the first index rule are as follows: to index setter setting Value be prefix, method parameter actual value is suffix, intermediate with the segmentation of English colon.
The actual value of parameter userName is Jack, then " userName:Jack " can be by a part as caching index.
Second index rule are as follows: if the index not set any value of setter, for default setting, own in method M The title and value of parameter are all added in caching index as a part of content, intermediate with the segmentation of English colon.
It include parametric user name userName (actual value Jack) and user's gender gender (practical in method M Value is male), then " userName:Jack:gender: male " can be added to caching index as a part of content.
The third index rule are as follows: if index setter is arranged in a composite object parameter, and the object is every A attribute both provides accessor method, will need to cover one or more attribute-names of caching index, by each attribute-name It covers in English double quotation marks, centre is simultaneously divided with comma;
It is set a property entitled prefix with indexing setter, passes through the correspondence attribute value that composite object accessor method obtains It is intermediate with the segmentation of English colon for suffix.
Composite object User (KeySetter (" useName ", " gender ") User), and userName accessor method Return value is Jack, and gender return value is male, then final " userName:Jack:gender: male " can be used as a part of content It is added in caching index.
4th kind of index rule is to carry out finally after adding using current system local environment alias and systematic name as prefix Cache the generation of index.
System local environment alias is prod, systematic name user-center, then the caching index ultimately generated is Prod:user-center:userName:Jack:gender: male guarantees the uniqueness of caching.
In the description of this specification, the description of reference term " one embodiment ", " example ", " specific example " etc. means Particular features, structures, materials, or characteristics described in conjunction with this embodiment or example are contained at least one implementation of the invention In example or example.In the present specification, schematic expression of the above terms may not refer to the same embodiment or example. Moreover, particular features, structures, materials, or characteristics described can be in any one or more of the embodiments or examples to close Suitable mode combines.
The foregoing is only a preferred embodiment of the present invention, but scope of protection of the present invention is not limited thereto, Anyone skilled in the art in the technical scope disclosed by the present invention, according to the technique and scheme of the present invention and its Inventive concept is subject to equivalent substitution or change, should be covered by the protection scope of the present invention.

Claims (10)

1. a kind of method for being written and read caching using caching blocker, which comprises the following steps:
SS01: user initiates to obtain the request of business datum;
SS02: if being provided with caching marker above the processing method A of user's request, it can be buffered blocker interception, delayed Method A can be marked by depositing marker, and system this method is told to need using caching;Then system at the time of initialization, All methods for indicating cache tag can be recorded in which in caching method list, i.e. method A can be recorded to caching method column In table, when system operation, the processing method A that system detection to user is requested is included in delay in caching method list Depositing blocker can intercept to being present in all methods in caching method list, and final the method A is typically preset Good caching blocker intercepts;
SS03: it after caching blocker intercepts the request of user, according to the index field of index setter setting, is given birth to from index Middle construction caching of growing up to be a useful person indexes;
SS04: the caching that index maker is obtained from caching indexes corresponding business datum;
SS05: if data cached is not sky, as hit is cached, and directly returns data to user;
SS06: if data cached for sky, as miss caching, calling business datum acquisition interface, by interface returned data It is arranged according to the caching index obtained into caching in caching blocker;
SS07: final service data are returned to user.
2. a kind of method for being written and read caching using caching blocker according to claim 1, which is characterized in that described The major function of caching blocker is to index setter according to caching according to explaining after identifier approach intercepts to indicating The value of setting, preferentially obtains data from caching, if there is data then directly return;If obtained from interface without data Business datum, and indexed according to caching, business datum is arranged into caching.
3. a kind of method for being written and read caching using caching blocker according to claim 1, which is characterized in that described Caching marker major function be setting need the method for carrying out data buffer storage to stamp mark, and be arranged caching it is expired when Between, beating calibration method by this marker will be intercepted by above-mentioned caching blocker.
4. a kind of method for being written and read caching using caching blocker according to claim 1, which is characterized in that described Index setter is the handling implement of setting caching index, and the major function for indexing setter is setting caching index, described The major function of index maker is finally read according to the setting value of index setter, and with certain index rule generation The caching index write.
5. a kind of method for being written and read caching using caching blocker according to claim 1, which is characterized in that described It is buffered marker and beats calibration method after the interception of buffered blocker, generated according to the setting of index setter and by index Device generates index, is postponed according to the index and is written and read data in warehousing, wherein caching library is data cached for saving.
6. a kind of method for being written and read caching using caching blocker according to claim 1, which is characterized in that described The label that the premise that setter can come into force has stamped caching for some method M using caching marker, and rope are indexed in step 3 It causes to grow up to be a useful person and will carry out caching index construction with certain rule, wherein index setter is the method M's for stamping cache tag The setting specifically indexed on certain several method parameter, the parameter as in method M included address name, then can be in the parameter Upper addition index setting.
7. a kind of method for being written and read caching using caching blocker according to claim 6, which is characterized in that described The index rule of index maker includes four kinds altogether, wherein the first index rule are as follows: with index setter setting value be before Sew, method parameter actual value is suffix, intermediate with the segmentation of English colon.
8. a kind of method for being written and read caching using caching blocker according to claim 7, which is characterized in that described Second index rule are as follows: if the index not set any value of setter, for default setting, the name of all parameters in method M Claim and value is all added in caching index as a part of content, it is intermediate with the segmentation of English colon.
9. a kind of method for being written and read caching using caching blocker according to claim 7, which is characterized in that described The third index rule are as follows: if index setter is arranged in a composite object parameter, and each attribute of the object Accessor method is provided, will need to cover one or more attribute-names of caching index, each attribute-name is covered into English In literary double quotation marks, centre is simultaneously divided with comma;
It is set a property entitled prefix with indexing setter, after being by the correspondence attribute value that composite object accessor method obtains Sew, it is intermediate with the segmentation of English colon.
10. a kind of method for being written and read caching using caching blocker according to claim 7, which is characterized in that institute State the 4th kind of index rule are as follows: final caching rope is carried out after adding using current system local environment alias and systematic name as prefix The generation drawn.
CN201910619472.8A 2019-07-10 2019-07-10 A method of caching is written and read using caching blocker Pending CN110362505A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910619472.8A CN110362505A (en) 2019-07-10 2019-07-10 A method of caching is written and read using caching blocker

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910619472.8A CN110362505A (en) 2019-07-10 2019-07-10 A method of caching is written and read using caching blocker

Publications (1)

Publication Number Publication Date
CN110362505A true CN110362505A (en) 2019-10-22

Family

ID=68218640

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910619472.8A Pending CN110362505A (en) 2019-07-10 2019-07-10 A method of caching is written and read using caching blocker

Country Status (1)

Country Link
CN (1) CN110362505A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110990153A (en) * 2019-11-27 2020-04-10 南京甄视智能科技有限公司 Dubbo interface caching method and device under distributed environment based on SpringCache
CN111090675A (en) * 2019-11-22 2020-05-01 福建亿榕信息技术有限公司 Multi-entry data caching method and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104461929A (en) * 2013-09-23 2015-03-25 中国银联股份有限公司 Distributed type data caching method based on interceptor
CN105187521A (en) * 2015-08-25 2015-12-23 努比亚技术有限公司 Service processing device and method
US20160248867A1 (en) * 2015-02-24 2016-08-25 Radware, Ltd. Optimization of asynchronous pushing of web resources
CN107463378A (en) * 2017-07-28 2017-12-12 深圳市丰巢科技有限公司 A kind of local cache implementation method, storage device and electronic equipment based on note
CN107832401A (en) * 2017-11-01 2018-03-23 郑州云海信息技术有限公司 Database data access method, system, device and computer-readable recording medium
CN108090768A (en) * 2017-11-14 2018-05-29 阿里巴巴集团控股有限公司 The method and device that a kind of business performs
CN109783248A (en) * 2018-12-13 2019-05-21 平安普惠企业管理有限公司 Data access method, device, computer equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104461929A (en) * 2013-09-23 2015-03-25 中国银联股份有限公司 Distributed type data caching method based on interceptor
US20160248867A1 (en) * 2015-02-24 2016-08-25 Radware, Ltd. Optimization of asynchronous pushing of web resources
CN105187521A (en) * 2015-08-25 2015-12-23 努比亚技术有限公司 Service processing device and method
CN107463378A (en) * 2017-07-28 2017-12-12 深圳市丰巢科技有限公司 A kind of local cache implementation method, storage device and electronic equipment based on note
CN107832401A (en) * 2017-11-01 2018-03-23 郑州云海信息技术有限公司 Database data access method, system, device and computer-readable recording medium
CN108090768A (en) * 2017-11-14 2018-05-29 阿里巴巴集团控股有限公司 The method and device that a kind of business performs
CN109783248A (en) * 2018-12-13 2019-05-21 平安普惠企业管理有限公司 Data access method, device, computer equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
唐瑶: "基于AOP拦截技术的精准信息推送服务研究", 《中国优秀硕士学位论文全文数据库(信息科技辑)》, no. 2, 15 February 2018 (2018-02-15), pages 139 - 240 *
幸俊: "AOP开发过程研究与应用", 《中国优秀硕士学位论文全文数据库(信息科技辑)》, no. 6, 15 December 2007 (2007-12-15), pages 138 - 145 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111090675A (en) * 2019-11-22 2020-05-01 福建亿榕信息技术有限公司 Multi-entry data caching method and storage medium
CN111090675B (en) * 2019-11-22 2022-12-02 福建亿榕信息技术有限公司 Multi-entry data caching method and storage medium
CN110990153A (en) * 2019-11-27 2020-04-10 南京甄视智能科技有限公司 Dubbo interface caching method and device under distributed environment based on SpringCache
CN110990153B (en) * 2019-11-27 2022-03-08 南京甄视智能科技有限公司 Dubbo interface caching method and device under distributed environment based on SpringCache

Similar Documents

Publication Publication Date Title
CN100543750C (en) A kind of matrix type data caching method and device of using based on WEB
CN103294710B (en) A kind of data access method and device
CN101777079B (en) Realization method for fast generating electronic report forms
CN110321344A (en) Information query method, device, computer equipment and the storage medium of associated data
US20030028555A1 (en) Database migration
CN103559227B (en) Webpage displaying method and browser
CN102375879A (en) Mobile GIS (Geographic Information System) system based on intelligent mobile phone and application thereof
CN103593298B (en) Method for recovering internal storage and device
CN106095698B (en) Caching write-in, read method and the device of object-oriented
CN110362505A (en) A method of caching is written and read using caching blocker
CN106599040A (en) Layered indexing method and search method for cloud storage
CN106407454A (en) Five-layer fifteen-level based tile type loading method for remote sensing image
CN107291471A (en) A kind of Meta model framework system for supporting customizable data acquisition
CN108536692A (en) A kind of generation method of executive plan, device and database server
CN105868297A (en) Online map based remote sensing interpretation sample calling method, apparatus and system
US7685230B2 (en) System and method for program execution
CN108614847A (en) A kind of caching method and system of data
CN1282111C (en) Across-platform data base researching method
CN106951182A (en) A kind of block device caching method and device
CN103020077A (en) Method for managing memory of real-time database of power system
CN110750372A (en) Log system based on shared memory and log management method
CN106055655A (en) Real-time data storage method and device, and real-time data access method and system
US7831541B2 (en) System and method for implementing browser milestone navigation in a data processing system
CN102609364A (en) Cache exchange method
CN107391175A (en) Control data collocation method and computer-readable recording medium

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20191022

RJ01 Rejection of invention patent application after publication