CN101706827B - Method for caching file of embedded browser - Google Patents

Method for caching file of embedded browser Download PDF

Info

Publication number
CN101706827B
CN101706827B CN2009103062846A CN200910306284A CN101706827B CN 101706827 B CN101706827 B CN 101706827B CN 2009103062846 A CN2009103062846 A CN 2009103062846A CN 200910306284 A CN200910306284 A CN 200910306284A CN 101706827 B CN101706827 B CN 101706827B
Authority
CN
China
Prior art keywords
node
nearest
url
life cycle
file management
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
Application number
CN2009103062846A
Other languages
Chinese (zh)
Other versions
CN101706827A (en
Inventor
胡涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan Changhong Electric Co Ltd
Original Assignee
Sichuan Hongwei 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 Sichuan Hongwei Technology Co Ltd filed Critical Sichuan Hongwei Technology Co Ltd
Priority to CN2009103062846A priority Critical patent/CN101706827B/en
Publication of CN101706827A publication Critical patent/CN101706827A/en
Application granted granted Critical
Publication of CN101706827B publication Critical patent/CN101706827B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention relates to the field of embedded technology, in particular to a method for caching a file of an embedded browser. The invention discloses a method for caching the file of the embedded browser; and cached files are selectively eliminated, and the response efficiency of the embedded browser is improved as much as possible in a finite storage space. The technical scheme adopts the following key points: a space with a fixed size is pre-allocated for caching all the acquired files locally; when the quantity of the cached files is less tan the cache space, the cached files are not released immediately; and when the cache space is almost full, files which are not used for the longest time are released firstly, and then files which are used most impossibly in the future according to estimation under a certain statistical rule are released. The method has the advantages that: the cached files are effectively eliminated selectively, the response efficiency of the browser is improved, and the method is suitable for the embedded browser.

Description

A kind of method for caching file of embedded browser
Technical field
The present invention relates to field of embedded technology, relate to a kind of method for caching file of embedded browser specifically.
Background technology
Along with the development of Internet technology, increasing content is transmitted by the internet and is visited.This application model based on Web (a kind of content platform based on http hypertext transfer protocol) and Browser (browser) more and more comes across in the various application and developments, is become B/S (Browser/Server---browser/server) application model usually.
The content of internet all is that the mode with file leaves on the Web server, is sent to browser client by http protocol, after browser handles, on the present terminal of contents table.When client browser got access to file from Web server, file can not directly be showed in terminal output usually, must do certain processing.Therefore, browser at first must carry out buffer memory with some files in this locality, be processed into the data that can directly show after, will show and show these data again.
The Web page is made up of the file of a plurality of separation.Many files as picture, script file, are often shared by a plurality of pages.Refresh in the process of the page at browser,, also can increase workflow, cause browser client to wait for the cycle lengthening of the page, thereby increased the execution cost, and reduced execution usefulness if these files of frequent request not only can cause network congestion.
In built-in field, resource is very limited, therefore can not a large amount of file of disposable buffer memory, a kind of superseded mechanism must be arranged, and make application in carrying out usefulness and taking up room, to obtain a balance.
Summary of the invention
Technical matters to be solved by this invention is: propose a kind of method for caching file of embedded browser, cache file is carried out selective elimination, under finite storage space, improve the response efficiency of built-in browser as far as possible.
The present invention solves the problems of the technologies described above the technical scheme that is adopted: a kind of method for caching file of embedded browser may further comprise the steps:
A. set up the cache file management formation;
B. be the spatial cache of a fixed size of cache file management queue assignment, the nearest life cycle of all pages of initialization is 0;
C. the url that waits for browser triggers;
D. when url trigger to arrive, judge whether current url triggers is root document url, if, execution in step e then, if not, execution in step f then;
E. the nearest life cycle with nodes all in the current cache file management formation adds 1, changes step f;
When f. judge triggering url, whether there has been url in the current cache file management formation, if, execution in step g then, if not, execution in step h then;
G. the node with this url correspondence takes out from the cache file management formation, and empties its nearest life cycle, and its nearest access times are added 1, inserts the cache file management formation again in order, jumps to step c;
H. send the url request, change step I;
I. the web file to getting access to is newly set up a node, log file data, url and file size, and with the nearest life cycle of this node and recently access times all put 0;
J. calculate the size of spatial cache residual capacity, and compare, if residual capacity is then changeed step k more than or equal to the present node file size, if residual capacity is then changeed step m less than the present node file size with the size of present node file;
K. node is put into the cache file management formation, jumped to step c;
M. by the part of nodes in the formation of certain rule release cache file management, jump to step j;
In the described step g, the node of this url correspondence is inserted cache file management formation: g1. in the following order from the cache file management queue heads, the nearest life cycle size of first node in the node of this url correspondence and the cache file management formation relatively, if the former greatly the next node of getting in the formation compare, if the latter is greatly then execution in step g2; G2. the size of the nearest access times of the nearest access times of the node of this url correspondence and the node in the formation relatively is if the former the little next node of then getting in the formation compares, if the former is execution in step g3 greatly then; G3. insert the node of this url correspondence in current location;
Among the described step k, node is put into the cache file management formation according to nearest life cycle size sequence, identical for nearest life cycle size, put into the cache file management formation according to the size of nearest access times;
Among the described step m, discharge the part of nodes in the cache file management formation according to the following rules: the node that preferentially discharges nearest life cycle maximum, if the node of a plurality of nearest life cycle maximums is arranged, the then preferential maximum and nearest minimum node of access times of nearest life cycle that discharges; Otherwise or, preferentially discharge the minimum node of nearest access times, if the minimum node of a plurality of nearest access times is arranged, the then preferential node that discharges the minimum and nearest life cycle maximum of nearest access times;
Described life cycle refers to the refreshing frequency interval of the page.
The invention has the beneficial effects as follows: cache file is carried out selective elimination effectively, improve the response efficiency of browser.
Description of drawings
Fig. 1 is a method flow diagram of the present invention.
Embodiment
The invention will be further described below in conjunction with accompanying drawing.
Main guiding theory of the present invention is: allocate the space of a fixed size in advance, all files that obtained are carried out local cache, when cache file amount during less than spatial cache, do not discharge buffer memory immediately; By the time spatial cache is when taking, at first discharge the file that those maximum durations are not used, discharging those again estimates according to certain statistical rules, the file that the possibility that will be used future is minimum, so cache file is carried out optionally eliminating, improve the response efficiency of built-in browser with regard to realizing.
As shown in Figure 1, the method for caching file of embedded browser among the present invention, take following measure to realize: a. sets up the cache file management formation; B. be the spatial cache of a fixed size of cache file management queue assignment, the nearest life cycle of all pages of initialization is 0, the life cycle here refers to the refreshing frequency interval of the page, life cycle is 1 when refreshing for the first time, life cycle is 2 when refreshing for the second time .... so analogize; C. the url (URL(uniform resource locator)) that waits for browser triggers; D. when url trigger to arrive, judge whether current url triggers is root document (page acquiescence document) url, if, execution in step e then, if not, execution in step f then; Here judging whether to be root document url, is to calculate the frequency of quoting to certain url resource for the refreshing frequency according to full page.
E. the nearest life cycle with nodes all in the current cache file management formation adds 1, represents that these nodes are refreshed now for the second time, changes step f; When f. judge triggering url, whether there has been url in the current cache file management formation, if, execution in step g then, if not, execution in step h then; G. the node with this url correspondence takes out from the cache file management formation, and empty its nearest life cycle, its nearest access times are added 1, again insert cache file management formation: g1. in order from the cache file management queue heads, the nearest life cycle size of first node in the node of this url correspondence and the cache file management formation relatively, if the former greatly the next node of getting in the formation compare, if the latter is greatly then execution in step g2; G2. the size of the nearest access times of the nearest access times of the node of this url correspondence and the node in the formation relatively is if the former the little next node of then getting in the formation compares, if the former is execution in step g3 greatly then; G3. insert the node of this url correspondence in current location; Jump to step c; H. send the url request, change step I; I. the web file to getting access to is newly set up a node, log file data, url and file size, and with the nearest life cycle of this node and recently access times all put 0; J. calculate the size of spatial cache residual capacity, and compare, if residual capacity is then changeed step k more than or equal to the present node file size, if residual capacity is then changeed step m less than the present node file size with the size of present node file; K. node is put into the cache file management formation according to nearest life cycle size sequence, for identical nearest life cycle size, put into the cache file management formation according to the size of nearest access times, jump to step c; M. discharge the part of nodes in the cache file management formation according to the following rules: the node that preferentially discharges nearest life cycle maximum, if the node of a plurality of nearest life cycle maximums is arranged, the then preferential maximum and nearest minimum node of access times of nearest life cycle that discharges.Otherwise equally also can, preferentially discharge the minimum node of nearest access times, if the minimum node of a plurality of nearest access times is arranged, the then preferential node that discharges the minimum and nearest life cycle maximum of nearest access times.

Claims (1)

1. method for caching file of embedded browser is characterized in that: may further comprise the steps:
A. set up the cache file management formation;
B. be the spatial cache of a fixed size of cache file management queue assignment, the nearest life cycle of all pages of initialization is 0;
C. the url that waits for browser triggers;
D. when url trigger to arrive, judge whether current url triggers is root document url, if, execution in step e then, if not, execution in step f then;
E. the nearest life cycle with nodes all in the current cache file management formation adds 1, changes step f;
When f. judge triggering url, whether there has been url in the current cache file management formation, if, execution in step g then, if not, execution in step h then;
G. the node with this url correspondence takes out from the cache file management formation, and nearest life cycle is put 0, and its nearest access times are added 1, inserts the cache file management formation again in order, jumps to step c;
H. send the url request, change step I;
I. the web file to getting access to is newly set up a node, log file data, url and file size, and with the nearest life cycle of this node and recently access times all put 0;
J. calculate the size of spatial cache residual capacity, and compare, if residual capacity is then changeed step k more than or equal to the present node file size, if residual capacity is then changeed step m less than the present node file size with the size of present node file;
K. node is put into the cache file management formation, jumped to step c;
M. by the part of nodes in the formation of certain rule release cache file management, jump to step j;
In the described step g, the node of this url correspondence is inserted cache file management formation: g1. in the following order from the cache file management queue heads, the nearest life cycle size of first node in the node of this url correspondence and the cache file management formation relatively, if the former greatly the next node of getting in the formation compare, if the latter is greatly then execution in step g2; G2. the size of the nearest access times of the nearest access times of the node of this url correspondence and the node in the formation relatively is if the former the little next node of then getting in the formation compares, if the former is execution in step g3 greatly then; G3. insert the node of this url correspondence in current location;
Among the described step k, node is put into the cache file management formation according to nearest life cycle size sequence, identical for nearest life cycle size, put into the cache file management formation according to the size of nearest access times;
Among the described step m, discharge the part of nodes in the cache file management formation according to the following rules: the node that preferentially discharges nearest life cycle maximum, if the node of a plurality of nearest life cycle maximums is arranged, the then preferential maximum and nearest minimum node of access times of nearest life cycle that discharges; Otherwise perhaps, preferentially discharge the minimum node of nearest access times, if the minimum node of a plurality of nearest access times is arranged, the then preferential node that discharges the minimum and nearest life cycle maximum of nearest access times;
Described life cycle refers to the refreshing frequency interval of the page.
CN2009103062846A 2009-08-28 2009-08-28 Method for caching file of embedded browser Active CN101706827B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2009103062846A CN101706827B (en) 2009-08-28 2009-08-28 Method for caching file of embedded browser

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2009103062846A CN101706827B (en) 2009-08-28 2009-08-28 Method for caching file of embedded browser

Publications (2)

Publication Number Publication Date
CN101706827A CN101706827A (en) 2010-05-12
CN101706827B true CN101706827B (en) 2011-09-21

Family

ID=42377052

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2009103062846A Active CN101706827B (en) 2009-08-28 2009-08-28 Method for caching file of embedded browser

Country Status (1)

Country Link
CN (1) CN101706827B (en)

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI506523B (en) * 2010-12-10 2015-11-01 Chiun Mai Comm Systems Inc System and method for accessing icons
CN102611725B (en) * 2011-01-25 2016-08-03 腾讯科技(深圳)有限公司 A kind of method and device of memory node
CN102880616B (en) * 2011-07-15 2016-02-17 腾讯科技(深圳)有限公司 browser page loading method and device
CN102420725B (en) * 2011-12-27 2014-05-21 华为技术有限公司 Method for detecting IP network bandwidth and apparatus thereof
CN103416027B (en) * 2012-01-31 2017-06-20 华为技术有限公司 The system of the method, buffer and cache optimization of cache optimization
CN103294718A (en) * 2012-02-29 2013-09-11 腾讯科技(深圳)有限公司 Method and device for web page cache management
CN103793426A (en) 2012-11-01 2014-05-14 腾讯科技(深圳)有限公司 Method and device for keeping web page access records
CN104636364B (en) * 2013-11-08 2019-04-16 腾讯科技(深圳)有限公司 The memory release method and device of browser
CN106649313B (en) * 2015-10-29 2020-11-27 阿里巴巴集团控股有限公司 Method and apparatus for processing cache data
CN105302497B (en) * 2015-11-24 2019-09-24 浪潮(北京)电子信息产业有限公司 A kind of buffer memory management method and system
CN108173974B (en) * 2018-03-01 2021-02-12 南京邮电大学 HCModel internal cache data elimination method based on distributed cache Memcached
CN111290347A (en) * 2018-12-10 2020-06-16 北京京东尚科信息技术有限公司 Monitoring method and system
TWI724696B (en) * 2019-12-18 2021-04-11 財團法人工業技術研究院 Workpiece hole measurement method

Also Published As

Publication number Publication date
CN101706827A (en) 2010-05-12

Similar Documents

Publication Publication Date Title
CN101706827B (en) Method for caching file of embedded browser
US10182127B2 (en) Application-driven CDN pre-caching
CN102880616B (en) browser page loading method and device
US9154572B2 (en) Changing I/O types for processing data requests
CN103425756B (en) The replication strategy of data block in a kind of HDFS
CN102104636A (en) Domain name system lookup latency reduction
CN104486350B (en) A kind of Web content accelerated method based on user behavior
JP6262939B2 (en) Cache system using network switch and cache service providing method
CN104754036A (en) Message processing system and processing method based on kafka
TW201027424A (en) Systems and methods to enable identification of different data sets
CN103428198B (en) network device, system and method
CN105550338A (en) HTML5 application cache based mobile Web cache optimization method
WO2023050712A1 (en) Task scheduling method for deep learning service, and related apparatus
CN104217019A (en) Content inquiry method and device based on multiple stages of cache modules
US10771358B2 (en) Data acquisition device, data acquisition method and storage medium
CN101777068A (en) Web page pre-reading and integrally browsing system for mobile communication equipment terminals and application method thereof
CN103905439A (en) Webpage browsing accelerating method based on home gateway
JP2020102838A5 (en)
CN107180050A (en) A kind of data grabber system and method
CN109327511A (en) A kind of data request method and server based on http protocol
CN106681990A (en) Method for reading caching data under mobile cloud storage environment
CN108769253B (en) Adaptive pre-fetching control method for optimizing access performance of distributed system
CN103945013A (en) Data transmission interface device and data transmission method
US20140143573A1 (en) Communication device and method
CN105988941B (en) Cache data processing method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C41 Transfer of patent application or patent right or utility model
TR01 Transfer of patent right

Effective date of registration: 20160414

Address after: 621000 Mianyang province high tech Zone, East Hing Road, No. 35 cotton

Patentee after: Sichuan Changhong Electrical Appliance Co., Ltd.

Address before: 1009, room 8, building 610041, high tech incubator Park, South Tianfu Road, Tianfu Road, Chengdu hi tech Zone, Sichuan

Patentee before: Panovasic Co., Ltd.