CN105100289A - Web caching method based on comment description - Google Patents

Web caching method based on comment description Download PDF

Info

Publication number
CN105100289A
CN105100289A CN201510611279.1A CN201510611279A CN105100289A CN 105100289 A CN105100289 A CN 105100289A CN 201510611279 A CN201510611279 A CN 201510611279A CN 105100289 A CN105100289 A CN 105100289A
Authority
CN
China
Prior art keywords
controller
data
caching
blocker
buffer memory
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
CN201510611279.1A
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.)
CHINA YOUKE COMMUNICATION TECHNOLOGY Co Ltd
Original Assignee
CHINA YOUKE COMMUNICATION TECHNOLOGY 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 CHINA YOUKE COMMUNICATION TECHNOLOGY Co Ltd filed Critical CHINA YOUKE COMMUNICATION TECHNOLOGY Co Ltd
Priority to CN201510611279.1A priority Critical patent/CN105100289A/en
Publication of CN105100289A publication Critical patent/CN105100289A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention aims to provide a web caching method based on comment description. In a controller, data caching of the method is set through @before (CacheInterceptor.class). A cache which is set by the controller of the method is eliminated through @Before(EvictInterceptor.class). According to the web caching method, programming operation by means of Java API is not used, thereby preventing operation error of a programmer. A user does not require considering a problem of caching a certain object into a certain cacheName. Different interceptor configurations are used in a cache reading operation and a cache eliminating operation. No parameter exists and the workload of the programmer is greatly reduced. The web caching method supports clustering arrangement of multiple cache servers. Furthermore a cache server is shutdown and offline, or the cache server goes online again, cache plug-ins are adapted automatically, thereby automatically adjusting distribution of the caches, and ensuring a fact that the cache hit rate reaches an expected number.

Description

A kind of based on explaining the Web caching method described
Technical field
The invention belongs to internet, applications field, being specifically related to a kind of based on explaining the Web caching method described.
Background technology
Buffer memory is exactly the buffering area (being called Cache) of exchanges data, and when a certain hardware will read data, first can search the data of needs from buffer memory, if having found, directly perform, the words that can not find then are looked for from internal memory.Because the speed of service of buffer memory is more faster than internal memory, therefore the effect of buffer memory helps hardware to run quickly exactly.
API is the calling interface that operating system leaves application program for, and application program makes operating system go the order (action) of executive utility by the API of call operation system.Existing scheme adopts general API mode to realize buffer memory, namely calls buffer memory API by developer is explicit, generally includes following two class API:
1, set/get method direct control buffer memory.Namely cache object is obtained by getCache (StringcacheName).SetCache (StringcacheName, StringcacheValue) arranges cache object.
When 2, obtaining data from database, first obtain from buffer memory.As queryByCache (StringcacheName, Stringsql), first the method obtains cache object corresponding to cacheName, when cache object is null, then performs sql statement and Query Result is buffered in cache object corresponding to cacheName.
What scheme 1 adopted is set/get method, need programmer active management cache, and in office what is the need for will obtain in the code of cache, and hard coded get method obtains the value of cache, and when cache is null, programmer then must setCache.These operations also relate to Multi-thread synchronization, and coding is easily made mistakes and caused dirty data.
Scheme 2 comparatively scheme 1 use more convenient, but the data cached of the program cannot upgrade, once after user have modified database table corresponding to sql inquiry by administration interface, the data of acquisition be still the data cached result of initial query, and again can not initiate sql and inquire about.
Summary of the invention
The object of this invention is to provide one simply based on the caching method that " explaining (Annotation) " formula describes, the person's of simplifying procedures coding and cache management difficulty, and guarantee automatic flush buffers.
The present invention realizes by the following technical solutions: a kind of based on explaining the Web caching method described, it is characterized in that: comprise the following steps: step S1: user browser initiates HTTP request, explain corresponding to the caching on querying method, first this request is buffered blocker interception; Step S2: buffer memory blocker finds the data be never cached on this Controller method and relevant parameter, then this Controller method and relevant parameter are mail to controller object process; Step S3: controller object performs various database query operations, obtain all data generated required for view, these data are returned to controller by database; Step S4: controller calls caching method, preserves all data generated required for view; Controller sends the data to view; Step S5: acquisition data render is become final html page by view, and is sent to user browser and shows; Step S6: when other user browsers send same HTTP request, when access had write the Controller method of buffer memory, first this request had been buffered blocker; Step S7: buffer memory blocker is data cached to the request in caching server Memcached; Step S8:Memcached sends it back the interception of buffer memory blocker by data cached; Query Result is returned to user browser by buffer memory blocker; Step S9: user browser initiates HTTP request, the removing caching changed in method corresponding to additions and deletions is explained, and first this request is eliminated the interception of buffer memory blocker; Step S10: remove buffer memory blocker and this Controller method and relevant parameter are mail to controller object process; Step S11: controller object performs various database additions and deletions and changes operation, and obtain all data generated required for view; The result that additions and deletions are changed data by database returns to controller; Step S12: controller calls caching method, removes all related datas that view needs; Controller sends the data to view; Step S13: acquisition data render is become final html page by view, and is sent to user browser and shows.
In an embodiment of the present invention, when comprising the method for INSERT, UPDATE or DELETE operation, being set to remove caching and removing all data cached of this controller; If only comprise the method for SELECT database table operation, be then set to caching and generate data cached.
Compared with prior art the present invention has the following advantages:
1, do not use JavaAPI programming operation, avoid programmer's operating mistake.User, without the need to considering what target cache in which cacheName, reads buffer memory and uses different blocker configurations respectively with removing caching, without any parameter, enormously simplify the workload of programmer;
2, the method supports the cluster configurations of many caching servers, and when the caching server machine of delaying rolls off the production line, or when caching server is reached the standard grade again, cache plug-in, by automatic adaptation, adjusts Cache sharing automatically, guarantees that the hit rate of buffer memory reaches expection.
Accompanying drawing explanation
Schematic flow sheet when Fig. 1 is the querying method of HTTP request Controller.
Fig. 2 be HTTP request Controller increasing, delete, schematic flow sheet when changing method.
Embodiment
Below in conjunction with the drawings and specific embodiments, the present invention will be further described.
Based on explaining the Web caching method described, it is characterized in that: comprise the following steps: step S1: user browser initiates HTTP request, explaining corresponding to the caching on querying method, first this request is buffered blocker interception; Step S2: buffer memory blocker finds the data be never cached on this Controller method and relevant parameter, then this Controller method and relevant parameter are mail to controller object process; Step S3: controller object performs various database query operations, obtain all data generated required for view, these data are returned to controller by database; Step S4: controller calls caching method, preserves all data generated required for view; Controller sends the data to view; Step S5: acquisition data render is become final html page by view, and is sent to user browser and shows; Step S6: when other user browsers send same HTTP request, when access had write the Controller method of buffer memory, first this request had been buffered blocker; Step S7: buffer memory blocker is data cached to the request in caching server Memcached; Step S8:Memcached sends it back the interception of buffer memory blocker by data cached; Query Result is returned to user browser by buffer memory blocker; Step S9: user browser initiates HTTP request, the removing caching changed in method corresponding to additions and deletions is explained, and first this request is eliminated the interception of buffer memory blocker; Step S10: remove buffer memory blocker and this Controller method and relevant parameter are mail to controller object process; Step S11: controller object performs various database additions and deletions and changes operation, and obtain all data generated required for view; The result that additions and deletions are changed data by database returns to controller; Step S12: controller calls caching method, removes all related datas that view needs; Controller sends the data to view; Step S13: acquisition data render is become final html page by view, and is sent to user browser and shows.
The flow process during querying method of HTTP request Controller see Fig. 1, the increasing of HTTP request Controller, delete, flow process when changing method is see Fig. 2.
Concrete, when comprising the method for INSERT, UPDATE or DELETE operation, being set to Before (EvictInterceptor.class) (removing caching) and removing all data cached of this controller; If only comprise the method for SELECT database table operation, be then set to CacheInterceptor.class) (caching) generate data cached.
In sum; above-listed preferred embodiment provided by the invention; the object, technical solutions and advantages of the present invention are further described; be understood that; the foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, within the spirit and principles in the present invention all; any amendment of doing, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (2)

1., based on explaining the Web caching method described, it is characterized in that: comprise the following steps:
Step S1: user browser initiates HTTP request, explains corresponding to the caching on querying method, and first this request is buffered blocker interception;
Step S2: buffer memory blocker finds the data be never cached on this Controller method and relevant parameter, then this Controller method and relevant parameter are mail to controller object process;
Step S3: controller object performs various database query operations, obtain all data generated required for view, these data are returned to controller by database;
Step S4: controller calls caching method, preserves all data generated required for view; Controller sends the data to view;
Step S5: acquisition data render is become final html page by view, and is sent to user browser and shows;
Step S6: when other user browsers send same HTTP request, when access had write the Controller method of buffer memory, first this request had been buffered blocker;
Step S7: buffer memory blocker is data cached to the request in caching server Memcached;
Step S8:Memcached sends it back the interception of buffer memory blocker by data cached; Query Result is returned to user browser by buffer memory blocker;
Step S9: user browser initiates HTTP request, the removing caching changed in method corresponding to additions and deletions is explained, and first this request is eliminated the interception of buffer memory blocker;
Step S10: remove buffer memory blocker and this Controller method and relevant parameter are mail to controller object process;
Step S11: controller object performs various database additions and deletions and changes operation, and obtain all data generated required for view; The result that additions and deletions are changed data by database returns to controller;
Step S12: controller calls caching method, removes all related datas that view needs; Controller sends the data to view;
Step S13: acquisition data render is become final html page by view, and is sent to user browser and shows.
2. according to claim 1 based on explaining the Web caching method described, it is characterized in that: when comprising the method for INSERT, UPDATE or DELETE operation, being set to remove caching and removing all data cached of this controller; If only comprise the method for SELECT database table operation, be then set to caching and generate data cached.
CN201510611279.1A 2015-09-24 2015-09-24 Web caching method based on comment description Pending CN105100289A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510611279.1A CN105100289A (en) 2015-09-24 2015-09-24 Web caching method based on comment description

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510611279.1A CN105100289A (en) 2015-09-24 2015-09-24 Web caching method based on comment description

Publications (1)

Publication Number Publication Date
CN105100289A true CN105100289A (en) 2015-11-25

Family

ID=54579803

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510611279.1A Pending CN105100289A (en) 2015-09-24 2015-09-24 Web caching method based on comment description

Country Status (1)

Country Link
CN (1) CN105100289A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106933644A (en) * 2015-12-31 2017-07-07 北京国双科技有限公司 Data processing method and device
CN107463378A (en) * 2017-07-28 2017-12-12 深圳市丰巢科技有限公司 A kind of local cache implementation method, storage device and electronic equipment based on note
CN107665235A (en) * 2017-07-27 2018-02-06 上海壹账通金融科技有限公司 Method for caching and processing, device, computer equipment and storage medium
CN108628891A (en) * 2017-03-21 2018-10-09 北京京东尚科信息技术有限公司 Realize method, apparatus, electronic equipment and the readable storage medium storing program for executing of data buffer storage layer
CN109710431A (en) * 2018-12-28 2019-05-03 四川新网银行股份有限公司 A method of it reducing large-scale distributed system interface and service calculates call number
CN110020271A (en) * 2017-08-04 2019-07-16 北京京东尚科信息技术有限公司 Method and system for cache management

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090031311A1 (en) * 2000-03-13 2009-01-29 General Electric Processing techniques for servers handling client/server traffic and communications
CN102043653A (en) * 2010-12-23 2011-05-04 中国农业银行股份有限公司 Cache system and methods for modifying cache configuration and operating and querying cache data
US20110276761A1 (en) * 2007-12-27 2011-11-10 Bratin Saha Accelerating software lookups by using buffered or ephemeral stores
CN103927345A (en) * 2014-03-28 2014-07-16 迈普通信技术股份有限公司 JSP (java server page) tag nesting method and device
CN104461929A (en) * 2013-09-23 2015-03-25 中国银联股份有限公司 Distributed type data caching method based on interceptor

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090031311A1 (en) * 2000-03-13 2009-01-29 General Electric Processing techniques for servers handling client/server traffic and communications
US20110276761A1 (en) * 2007-12-27 2011-11-10 Bratin Saha Accelerating software lookups by using buffered or ephemeral stores
CN102043653A (en) * 2010-12-23 2011-05-04 中国农业银行股份有限公司 Cache system and methods for modifying cache configuration and operating and querying cache data
CN104461929A (en) * 2013-09-23 2015-03-25 中国银联股份有限公司 Distributed type data caching method based on interceptor
CN103927345A (en) * 2014-03-28 2014-07-16 迈普通信技术股份有限公司 JSP (java server page) tag nesting method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
(美)戴尼奥: "《服务设计模式:SOAP/WSDL与RESTful Web服务设计解决方案》", 1 November 2013 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106933644A (en) * 2015-12-31 2017-07-07 北京国双科技有限公司 Data processing method and device
CN108628891A (en) * 2017-03-21 2018-10-09 北京京东尚科信息技术有限公司 Realize method, apparatus, electronic equipment and the readable storage medium storing program for executing of data buffer storage layer
CN107665235A (en) * 2017-07-27 2018-02-06 上海壹账通金融科技有限公司 Method for caching and processing, device, computer equipment and storage medium
CN107665235B (en) * 2017-07-27 2020-06-30 深圳壹账通智能科技有限公司 Cache processing method and device, computer equipment and storage medium
CN107463378A (en) * 2017-07-28 2017-12-12 深圳市丰巢科技有限公司 A kind of local cache implementation method, storage device and electronic equipment based on note
CN110020271A (en) * 2017-08-04 2019-07-16 北京京东尚科信息技术有限公司 Method and system for cache management
CN109710431A (en) * 2018-12-28 2019-05-03 四川新网银行股份有限公司 A method of it reducing large-scale distributed system interface and service calculates call number

Similar Documents

Publication Publication Date Title
CN105100289A (en) Web caching method based on comment description
US9600492B2 (en) Data processing performance enhancement in a distributed file system
CN104572979B (en) A kind of method and device of processing structure query language SQL
CN103617131A (en) Data caching achieving method
CN109542907B (en) Database cache construction method and device, computer equipment and storage medium
US10534776B2 (en) Proximity grids for an in-memory data grid
CN112035528B (en) Data query method and device
CN105183839A (en) Hadoop-based storage optimizing method for small file hierachical indexing
US9898477B1 (en) Writing to a site cache in a distributed file system
US20160188749A1 (en) Feed Data Storage and Query
CN110235118B (en) Optimizing content storage through stubbing
US20220114143A1 (en) Path name cache for notifications of file changes
CN104331428A (en) Storage and access method of small files and large files
CN107766343B (en) Data storage method and device and storage server
WO2018120876A1 (en) Method and device for searching for cache update
CN108614847B (en) Data caching method and system
US10824612B2 (en) Key ticketing system with lock-free concurrency and versioning
CN110765036B (en) Method and device for managing metadata at a control device
CN110990439A (en) Cache-based quick query method and device, computer equipment and storage medium
US20220156243A1 (en) Method, device, and computer program product for managing storage system
US20240012813A1 (en) Dynamic prefetching for database queries
KR20210040864A (en) File directory traversal method, apparatus, device, and medium
CN105915619A (en) Access heat regarded cyber space information service high performance memory caching method
CN110650182B (en) Network caching method and device, computer equipment and storage medium
US10445296B1 (en) Reading from a site cache in a distributed file system

Legal Events

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

Application publication date: 20151125

RJ01 Rejection of invention patent application after publication