CN105117350B - A kind of configurable caching system and method - Google Patents
A kind of configurable caching system and method Download PDFInfo
- Publication number
- CN105117350B CN105117350B CN201510526584.0A CN201510526584A CN105117350B CN 105117350 B CN105117350 B CN 105117350B CN 201510526584 A CN201510526584 A CN 201510526584A CN 105117350 B CN105117350 B CN 105117350B
- Authority
- CN
- China
- Prior art keywords
- request
- scheduler
- end scheduler
- header
- variable
- 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.)
- Active
Links
Abstract
A kind of configurable caching system and method, including front end scheduler, front end cache server, relevant location rules and embedded script Lua language are configured in the front end scheduler, the present invention passes through url rewriting techniques and self-defined header thresholdings in front end scheduler, exclusion may interfere with the factor of caching, utmostly ensure the hit rate of caching.Ensure that different URL are cached by uniform logical, while ensuring that same URL provides separate cache logic for login user.
Description
Technical field
The present invention relates to internet arena more particularly to a kind of front end caching system and methods.
Background technology
Caching technology is ubiquitous in computer systems, from computer to various routing devices, from software realization to hard
Part is realized, is designed good caching system, can be greatly improved the response speed of system, improve user experience.It answers internet
In, caching system is divided into as the rear ends such as memcache, redis caching and Squid, Varnish, Nginx, Apache
The front ends such as Traffic Server caching system.No matter front end caches or rear end caching, business demand is adapted to, improves caching life
Middle rate is most important pursuit.
Front end buffer service herein means using CDN technologies, utilize Squid, Varnish, Nginx, Apache Traffic
Server etc. does front end buffering, provides buffer service described in http protocol.
The http protocol specific definition support details of front end buffer service and browser local cache, whether caching
It is influenced by url, multiple http header thresholdings.In real business scenario, browser, operating system, url are redirected, get joins
The many factors such as number, cookie values change, and may cause caching invalid.
Invention content
It is an object of the present invention to solve the deficiency of the existing technology and provide a kind of configurable caching systems and method.
The first purpose of the invention is to provide a kind of configurable caching systems, including front end scheduler, front end caching
Server is configured with relevant location rules and embedded script Lua language, the front end tune in the front end scheduler
Device is spent by judging access request, makees correlated judgment according to whether url matches customized header parameters, and will finally execute
Complete parameter passes to front end cache server.
Second object of the present invention is to provide a kind of configurable caching method, passes through above-mentioned configurable caching system
System is realized, including at least following steps:
(1)Front end scheduler forwarding request judges this time to ask, and ensures only to match GET request;
(2)Front end scheduler detects required parameter, is rewritten by url, eliminates the parameter of unrelated logic, it is ensured that band in request
There is the parameter of unrelated logic all to hit the same buffered results;
(3)The cookie contents of front end scheduler detection this time request are extracted and execute the relevant cookie values of logic;
(4)Other header contents of front end scheduler detection this time request are extracted and execute the relevant thresholding of logic, and
Thresholding is passed to the variable flang of a configuration;
(5)Whether front end scheduler judgment variable flang matches preset value, if it does, just value is transmitted all to silent
The variable deflang recognized generates correct header thresholdings;
(6)Final header thresholdings are passed to front end cache server by front end scheduler.
Above-mentioned a kind of configurable caching method, wherein in the step(2)In, by front-end proxy agent layer
Location rules, judge required parameter, if can cache, carry out url rewritings.
Above-mentioned a kind of configurable caching system, wherein the front end scheduler uses Nginx proxy server.
In conclusion due to the adoption of the above technical scheme, the present invention passes through url rewriting techniques and oneself in front end scheduler
Header thresholdings are defined, the factor that may interfere with caching is excluded, utmostly ensures the hit rate of caching.Ensure different URL by
Uniform logical caches, while ensuring that same URL provides separate cache logic for login user.
Description of the drawings
Fig. 1 is a kind of flow chart of configurable caching system and method for the present invention.
Specific implementation mode
The specific implementation mode of the present invention is described in detail below in conjunction with the accompanying drawings.
Embodiment 1
Fig. 1, a kind of configurable caching system of the invention, including front end scheduler, front end cache server are referred to,
Front end scheduler herein means seven layers of application proxy software being widely used in web exploitations, including nginx, haproxy etc. all
It is very efficient front end scheduler, the preferred nginx of the present invention.
In front end scheduler be configured with relevant location rules and embedded script Lua language, the present invention by
Embedded script Lua Programming with Pascal Language, by url rewriting techniques and self-defined header thresholdings in front end scheduler, exclusion can
The factor that caching can be interfered, utmostly ensures the hit rate of caching.
The configurable caching method of the present invention, by above-mentioned configurable caching system realization, including at least below
Step:
(1)Front end scheduler forwarding request judges this time to ask, makes this by request_method=GET parameters
Body only matches GET request.
(2)Front end scheduler detects required parameter, by the location rules in front-end proxy agent layer, judges request ginseng
Number, if can cache, carries out url rewritings.It is rewritten by url, eliminates the parameter of unrelated logic, it is ensured that patrolled with unrelated in request
The parameter collected all hits the same buffered results.
For example, " rewrite/demo.phptest=abc /demo.php last;", parameter test=abc in example
It is unrelated with logic is executed, final result is not influenced, passes through this rewriting, it is ensured that `/demo.phpTest=abc` with "/
Demo.php " hits same buffered results.
(3)The cookie contents of front end scheduler detection this time request are extracted and execute the relevant cookie values of logic.
For example, the language version inspection in user cookie, sets the variable deflang of a default value, if
There are other values in cookie, and the content of variable is just made into corresponding value.
set $deflang en;
If ( $cookie_deflang ) {
set $deflang $cookie_deflang;
}。
(4)Other header contents of front end scheduler detection this time request are extracted and execute the relevant thresholding of logic, and
Thresholding is passed to the variable flang of a configuration.
For example, the inspection of user browser language environment:
set_by_lua $flang ‘
local I = ngx.req.get_headers()[‘Accept-Language’]
return l
‘。
(5)Whether front end scheduler judgment variable flang matches preset value, if it does, just value is transmitted all to silent
The variable deflang recognized generates correct header thresholdings;And by the Fastcig_param of nginx the variable of acquiescence
Pass to front end cache server.
For example, being detected for language version:
if ( $flang ~ ‘zh’ ) {
set $deflang zh;
}
Fastcgi_param HTTP_VARY_DEFLANG $deflang。
(6)Final header thresholdings are passed to front end cache server by front end scheduler.
By above-mentioned steps(1)~(6), it is ensured that different URL are cached by uniform logical, while ensuring that same URL is to log in use
Family provides separate cache logic.
Embodiment 2
Example is divided into login user language version, the present invention is divided into agency service configuration logic and response matching is patrolled
It collects and constitutes.
It is as follows that agency service configures example logic:
rewrite /demo.phptest=abc /demo.php last;# is redirected using inside reaches modification
The purpose of url
set $deflang en;# default values
set_by_lua $flang '
local l = ngx.req.get_headers()['Accept-Language']
return l
';
If ($ flang ~ ' zh') { # browser logics -- request header
Accept-Language
set $deflang zh;
}
If ($ cookie_deflang) { #cookie logics -- deflang
set $deflang $cookie_deflang;
}
fastcgi_param HTTP_VARY_DEFLANG $deflang;# generates request header Vary-Deflang.
It is as follows to respond matching logic:
header('Vary: Vary-Deflang‘)。
Above example shows only the matching and rewriting of a specific url, and the detection zone for user language version
Point, by simple extension, the detection that can further apply any url matching rewrite process and other parameters is realized.
Embodiment described above is merely to illustrate the technological thought and feature of this patent, in the art its object is to make
Technical staff can understand the content of this patent and implement according to this, the patent model of this patent cannot be only limited with the present embodiment
It encloses, i.e., it is all according to same changes or modifications made by the revealed spirit of this patent, it still falls in the scope of the claims of this patent.
Claims (4)
1. a kind of configurable caching system, which is characterized in that including front end scheduler, front end cache server, the front end
Relevant location rules and embedded script Lua language are configured in scheduler, the front end scheduler forwarding request is sentenced
It is disconnected this time to ask, and ensure only to match GET request, required parameter is then detected, by location rules, judges request ginseng
Number carries out url rewritings, other header contents of front end scheduler detection this time request if can cache, and extraction is patrolled with execution
Relevant thresholding is collected, and thresholding is passed to the variable flang of a configuration, then whether judgment variable flang matches default
Value generate correct header thresholdings, and will most if it does, just preset value is passed to the variable deflang of acquiescence
Whole header thresholdings pass to front end cache server.
2. a kind of configurable caching system according to claim 1, which is characterized in that the front end scheduler uses
Nginx proxy server.
3. a kind of configurable caching method, which is characterized in that real by configurable caching system described in claim 1
It is existing, including at least following steps:
(1) front end scheduler forwarding request judges this time to ask, and ensures only to match GET request;
(2) front end scheduler detect required parameter, rewritten by url, eliminate the parameter of unrelated logic, it is ensured that in request band whether there is or not
The parameter for closing logic all hits the same buffered results;
(3) the cookie contents of front end scheduler detection this time request are extracted and execute the relevant cookie values of logic;
(4) other header contents of front end scheduler detection this time request are extracted and execute the relevant thresholding of logic, and domain
Value passes to the variable flang of a configuration;
(5) whether front end scheduler judgment variable flang matches preset value, if it does, just the transmission of preset value is all given
The variable deflang of acquiescence generates correct header thresholdings;
(6) final header thresholdings are passed to front end cache server by front end scheduler.
4. a kind of configurable caching method according to claim 3, which is characterized in that in the step (2), by preceding
The location rules in Agent layer are held, required parameter is judged, if can cache, carries out url rewritings.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510526584.0A CN105117350B (en) | 2015-08-25 | 2015-08-25 | A kind of configurable caching system and method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510526584.0A CN105117350B (en) | 2015-08-25 | 2015-08-25 | A kind of configurable caching system and method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105117350A CN105117350A (en) | 2015-12-02 |
CN105117350B true CN105117350B (en) | 2018-08-24 |
Family
ID=54665348
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510526584.0A Active CN105117350B (en) | 2015-08-25 | 2015-08-25 | A kind of configurable caching system and method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105117350B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106777033B (en) * | 2016-12-09 | 2019-06-25 | 北京齐尔布莱特科技有限公司 | The method that Squid removes cache file according to catalogue format |
CN106844600A (en) * | 2017-01-16 | 2017-06-13 | 百融(北京)金融信息服务股份有限公司 | A kind of website picture processing system and method |
CN109344353B (en) * | 2018-09-12 | 2021-10-08 | 福建天泉教育科技有限公司 | Configurable local cache refreshing method and terminal |
CN109766270A (en) * | 2018-12-19 | 2019-05-17 | 北京万维之道信息技术有限公司 | Project testing method and device, server, platform |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102355504A (en) * | 2011-10-17 | 2012-02-15 | 苏州迈科网络安全技术股份有限公司 | Online flash video (FLV) cache method and device |
CN102668518A (en) * | 2011-12-02 | 2012-09-12 | 华为技术有限公司 | Content distribution network routing method, system, and user terminal |
CN103227815A (en) * | 2013-03-25 | 2013-07-31 | 深信服网络科技(深圳)有限公司 | Method and device for controlling cache of browser |
US8892680B2 (en) * | 2011-01-25 | 2014-11-18 | Openwave Mobility, Inc. | System and method for caching content elements with dynamic URLs |
-
2015
- 2015-08-25 CN CN201510526584.0A patent/CN105117350B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8892680B2 (en) * | 2011-01-25 | 2014-11-18 | Openwave Mobility, Inc. | System and method for caching content elements with dynamic URLs |
CN102355504A (en) * | 2011-10-17 | 2012-02-15 | 苏州迈科网络安全技术股份有限公司 | Online flash video (FLV) cache method and device |
CN102668518A (en) * | 2011-12-02 | 2012-09-12 | 华为技术有限公司 | Content distribution network routing method, system, and user terminal |
CN103227815A (en) * | 2013-03-25 | 2013-07-31 | 深信服网络科技(深圳)有限公司 | Method and device for controlling cache of browser |
Also Published As
Publication number | Publication date |
---|---|
CN105117350A (en) | 2015-12-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105117350B (en) | A kind of configurable caching system and method | |
Shahbaz et al. | Pisces: A programmable, protocol-independent software switch | |
US20220405342A1 (en) | Progressive prefetching | |
CN112073320B (en) | API (application program interface) gray level release method and device based on cloud gateway and computer equipment | |
US11122067B2 (en) | Methods for detecting and mitigating malicious network behavior and devices thereof | |
Wang et al. | How speedy is {SPDY}? | |
US10033748B1 (en) | System and method employing structured intelligence to verify and contain threats at endpoints | |
WO2018121331A1 (en) | Attack request determination method, apparatus and server | |
US9405555B2 (en) | Automated code splitting and pre-fetching for improving responsiveness of browser-based applications | |
US11144667B2 (en) | Machine-driven crowd-disambiguation of data resources | |
US11675868B2 (en) | Dynamic service worker code for storing information in web browser | |
CN106453438B (en) | Network attack identification method and device | |
US10798192B2 (en) | Methods and apparatus to improve usage crediting in mobile devices | |
CN110086811B (en) | Malicious script detection method and related device | |
Chaignon et al. | Oko: Extending open vswitch with stateful filters | |
CN103957289B (en) | A kind of DNSSEC analytic methods based on complex network | |
CN105873058B (en) | Local portal caching method | |
CN106878311B (en) | HTTP message rewriting method and device | |
KR20110022141A (en) | Apparatus for detecting and preventing application layer distribute denial of service attack and method | |
CN106850599B (en) | A kind of NAT detection method based on fusion user behavior and sudden peal of thunder ID | |
CN104811507B (en) | A kind of IP address acquisition methods and device | |
CN106528225B (en) | A kind of hot update method and device of game server | |
US10778744B2 (en) | Configurable caching system and method thereof | |
CN104732144B (en) | A kind of remote code injection loophole detection method based on pseudo- agreement | |
US20150193567A1 (en) | System and method of performing analytics with respect to content storing servers caching popular content |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into 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: 20190108 Address after: 200233 Block A, Room 501, 12 Block 1001 Qinzhou North Road, Xuhui District, Shanghai Patentee after: Shanghai Moku Data Technology Co., Ltd. Address before: Room 6020, 6th floor, No. 399 Fute North Road, Pudong New Area Free Trade Pilot Area, Shanghai, 2001 Patentee before: Mobi (Shanghai) Biotechnology Co. Ltd. |
|
TR01 | Transfer of patent right |