+

WO2018161294A1 - Local caching method and apparatus for application program - Google Patents

Local caching method and apparatus for application program Download PDF

Info

Publication number
WO2018161294A1
WO2018161294A1 PCT/CN2017/076095 CN2017076095W WO2018161294A1 WO 2018161294 A1 WO2018161294 A1 WO 2018161294A1 CN 2017076095 W CN2017076095 W CN 2017076095W WO 2018161294 A1 WO2018161294 A1 WO 2018161294A1
Authority
WO
WIPO (PCT)
Prior art keywords
application
data
local
list page
local data
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.)
Ceased
Application number
PCT/CN2017/076095
Other languages
French (fr)
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.)
Shenzhen Techvisum Technologies Ltd (sttl)
Original Assignee
Shenzhen Techvisum Technologies Ltd (sttl)
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 Shenzhen Techvisum Technologies Ltd (sttl) filed Critical Shenzhen Techvisum Technologies Ltd (sttl)
Priority to PCT/CN2017/076095 priority Critical patent/WO2018161294A1/en
Publication of WO2018161294A1 publication Critical patent/WO2018161294A1/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor

Definitions

  • the present invention relates to the field of communications technologies, and in particular, to an application local cache method and apparatus.
  • the main purpose of the present invention is to solve the technical problem that the prior art has a slower speed and a larger resource overhead when the application page is loaded.
  • the present invention provides an application local caching method, the method comprising:
  • the first application data of the application is obtained from the server through the application program interface, and the first application data is displayed by using the list page;
  • the first application data is saved as the local data.
  • the method further includes:
  • the local data is obtained and the local data is presented through the list page.
  • the method further includes:
  • the updated local data is displayed through the list page to refresh the list page.
  • the method further includes:
  • a local cache space is allocated from the terminal memory space for storing local data of the application.
  • the local data cache mode is localStorage
  • the local cache space is a localStorage space.
  • an application local cache device including:
  • a detecting module configured to detect, when the application list page is opened, whether the terminal has local data of the application
  • An obtaining module configured to acquire first application data of the application from a server through an application program interface when the local data does not exist
  • a display module configured to display the first application data by using the list page
  • an update module configured to save the first application data as the local data.
  • the obtaining module is further configured to acquire the local data when the local data exists;
  • the presentation module is further configured to display the local data through the list page.
  • the obtaining module is further configured to: when detecting a refresh operation of the user on the list page, acquire second application data of the application from a server through an application program interface;
  • the application local cache device further includes:
  • a calculation module configured to separately calculate and compare the md5 value of the second application data and the md5 value of the local data
  • the update module is further configured to save the second application data as new local data to update the local data when the two md5 values are different;
  • the display module is further configured to display the updated local data through the list page to refresh the list page.
  • the application local cache device further includes:
  • a dividing module configured to divide a local cache space from the terminal memory space, and store local data of the application.
  • the local data cache mode is localStorage
  • the local cache space is a localStorage space.
  • the application local caching method and apparatus when detecting that the application list page is opened, detecting whether the terminal has local data of the application; if not, acquiring the local device from the server through the application program interface Determining the first application data of the application, displaying the first application data through the list page; and saving the first application data as the local data.
  • the data of the list page is cached locally, and the display can be realized by accessing the local data when the list is displayed, which reduces the pressure of the back-end server to a certain extent, and supports the offline access of the user and improves the page loading speed. Greatly improved the user experience.
  • FIG. 1 is a schematic flowchart of a first embodiment of an application local cache method according to the present invention
  • FIG. 2 is a schematic flowchart of a second embodiment of an application local cache method according to the present invention.
  • FIG. 3 is a schematic diagram of functional modules of a first embodiment of an application local cache device according to the present invention.
  • FIG. 4 is a schematic diagram of functional modules of a second embodiment of an application local cache device of the present invention.
  • the terminal includes, but is not limited to, a mobile terminal such as an IPAD or a mobile phone.
  • FIG. 1 is a schematic flowchart diagram of a first embodiment of an application local cache method according to the present invention.
  • the application local caching method includes:
  • Step S10 when detecting that the application list page is opened, detecting whether the terminal has local data of the application;
  • the application needs to verify the user.
  • the application For the application that needs to verify the login, after the user opens the application and successfully logs in, the application needs to display the default list page to the user, or the user can Select a list page to open.
  • the terminal detects that a certain list page of the application is opened, the page needs to be loaded. At this time, the terminal needs to acquire the page data, and firstly detects whether the local data of the application exists in the local storage space.
  • step S10 the method further includes the following steps:
  • a local cache space is allocated from the terminal memory space for storing local data of the application.
  • a local cache space of a certain size is allocated from the terminal memory space for storing local data cached by the application on the terminal to the local. It can be understood that in the local cache space, local data of more than one application is stored.
  • the storage location of each application and its corresponding local data can be recorded through a mapping table. When local data corresponding to an application needs to be acquired or detected, the storage location of the corresponding local data can be obtained from the mapping table to find The local data.
  • the storage mode of the data local cache includes, but is not limited to, local storage, websql, sqllite, and the like.
  • the local storage method of the HTML5 is preferably used.
  • the local cache space is preferably localStorage space.
  • Step S20 if not, acquiring the first application data of the application from the server through the application program interface, and displaying the first application data by using the list page;
  • Step S30 saving the first application data as the local data.
  • Interface Programming Interface application programming interface
  • API application programming interface
  • the terminal obtains the data required for the list page display, and the first application data can be displayed through the list page.
  • the application data acquired from the server mainly refers to data required by the application for displaying the list page, including but not limited to audio data, video data, picture data, and text data.
  • the cached local data is generally the data of one page of the current application. For example, for a list page, generally only the data of the current list page needs to be saved, and the page data of the page turning does not need to be cached.
  • local data can be saved by md5 (Message Digest) Algorithm 5, MD5, Message Digest Algorithm Fifth Edition, abbreviated Abstract Algorithm) is encrypted to ensure data integrity.
  • md5 Message Digest Algorithm 5
  • MD5 Message Digest Algorithm Fifth Edition, abbreviated Abstract Algorithm
  • Step S40 if yes, acquiring the local data and displaying the local data through the list page.
  • the local data corresponding to the application is generally stored in the local cache space.
  • the terminal may directly acquire the local data, load the list page, and display the local data, for example, display related picture text or video data.
  • the user can click on the corresponding picture or text link to open a new list page.
  • the user can also refresh the current list page by refreshing operations such as pulling down or clicking a refresh button to update the page content.
  • the application local caching method detects whether the terminal has local data of the application when it is detected that the application list page is opened; if not, the application is obtained from the server through the application program interface. a first application data of the program, the first application data is displayed through the list page; and the first application data is saved as the local data.
  • the data of the list page is cached locally, and the display can be realized by accessing the local data when the list is displayed, which reduces the pressure of the back-end server to a certain extent, and supports the offline access of the user and improves the page loading speed. Greatly improved the user experience.
  • FIG. 2 is a schematic flowchart diagram of a second embodiment of an application local cache method according to the present invention.
  • the difference from the first embodiment of the application local caching method is that, in this embodiment, in addition to steps S10-S40 (not shown again), the method further includes:
  • Step S50 when detecting a refresh operation of the user on the list page, acquiring second application data of the application from a server through an application program interface;
  • Step S60 respectively calculating the md5 value of the second application data and the md5 value of the local data, and comparing the values;
  • Step S70 if the two md5 values are different, saving the second application data as new local data to update the local data;
  • Step S80 displaying the updated local data through the list page to refresh the list page.
  • the terminal detects the user's operation in real time.
  • the server needs to request to confirm whether the current page has updated content to be displayed.
  • the terminal will request data from the server through the API.
  • the terminal returns data through two callback functions of the middle layer, one returns local cache data, and one returns the application data of the current application returned by the server through the API (ie, the second application data).
  • the callback function is called, the first pass A callback returns local data.
  • the server requests a return, it compares the local data with the returned second application data.
  • the local data is updated, and then the second callback returns the updated page data; if there is no update, it remains unchanged. change.
  • comparing the local data and the returned second application data it is mainly confirmed by comparing the md5 values of the two whether the two are consistent data. If the md5 values are different, the two are different data, and the current page needs to be updated, and vice versa.
  • the second application data returned is the same as the local data currently stored locally, and the current page does not need to be updated.
  • the terminal first obtains the local data presentation from the local, and then obtains the application data refresh of the current application from the application interface according to the refresh operation of the user, and simultaneously compares the md5 with the local data. Different, store a copy into the local localstorage, and md5 encrypt the data, and update the current page table page; the same, the application interface remains unchanged.
  • the application local caching method provided by the above embodiment can update the local data in real time through the md5 value comparison, and can save the page update while enabling the user to seamlessly see the latest data, and realize the user angle while ensuring the page update. Seamless slot page switching.
  • FIG. 4 is a schematic diagram of functional modules of a first embodiment of a mouse application local cache device according to the present invention.
  • the application local cache device 100 is applied to the terminal, and includes:
  • the detecting module 101 is configured to detect, when the application list page is opened, whether the terminal has local data of the application;
  • the application needs to verify the user.
  • the application For the application that needs to verify the login, after the user opens the application and successfully logs in, the application needs to display the default list page to the user, or the user can Select a list page to open.
  • the terminal detects that a certain list page of the application is opened, the page needs to be loaded. At this time, the terminal needs to acquire the page data, and the detecting module 101 first detects whether the local data of the application exists in the local storage space.
  • the application local cache device 100 further includes:
  • the dividing module 106 is configured to divide a local cache space from the terminal memory space for storing local data of the application.
  • the dividing module 106 divides a certain size of the local cache space from the terminal memory space for storing the local data cached by the application on the terminal to the local. It can be understood that in the local cache space, local data of more than one application is stored. The storage location of each application and its corresponding local data can be recorded through a mapping table. When local data corresponding to an application needs to be acquired or detected, the storage location of the corresponding local data can be obtained from the mapping table to find The local data.
  • the storage mode of the data local cache includes, but is not limited to, local storage, websql, sqllite, and the like.
  • the local storage method of the HTML5 is preferably used.
  • the local cache space is preferably localStorage space.
  • the obtaining module 102 is configured to: when the local data does not exist, obtain the first application data of the application from the server through the application program interface and save the data as the local data;
  • the display module 103 is configured to display the first application data by using the list page;
  • the update module 104 is configured to save the first data as the local data.
  • the application may be used for the first time or the user performs the clearing cache operation. Therefore, the data displayed this time needs to be acquired from the server, and the module 102 is acquired at this time.
  • a data request is made to the server through an application program interface (API) and the first application data of the application returned by the server is received, and the first application data is saved by the update module 104 into the local cache space as local data of the application.
  • the obtaining module 102 obtains the data required for the display of the list page, and the display module 103 can display the first application data through the list page.
  • API application program interface
  • the application data acquired from the server mainly refers to data required by the application for displaying the list page, including but not limited to audio data, video data, picture data, and text data.
  • the cached local data is generally the data of one page of the current application. For example, for a list page, generally only the data of the current list page needs to be saved, and the page data of the page turning does not need to be cached.
  • the preservation of local data can be saved by md5 encryption to ensure data integrity.
  • the obtaining module 102 is further configured to acquire the local data when the local data exists;
  • the presentation module 103 is further configured to display the local data through the list page.
  • the local data corresponding to the application is generally stored in the local cache space.
  • the obtaining module 102 can directly obtain the local data, and the display module 103 loads the list page and displays the local data, for example, displaying related picture text or video data.
  • the user can click on the corresponding picture or text link to open a new list page.
  • the user can also refresh the current list page by refreshing operations such as pulling down or clicking a refresh button to update the page content.
  • the application local cache device detects whether the terminal has local data of the application when it is detected that the application list page is opened; if not, the application is obtained from the server through the application program interface. a first application data of the program, the first application data is displayed through the list page; and the first application data is saved as the local data.
  • the data of the list page is cached locally, and the display can be realized by accessing the local data when the list is displayed, which reduces the pressure of the back-end server to a certain extent, and supports the offline access of the user and improves the page loading speed. Greatly improved the user experience.
  • FIG. 4 is a schematic diagram of functional modules of a second embodiment of an application local cache method according to the present invention. The difference from the first embodiment of the application local caching device is that in this embodiment:
  • the obtaining module 102 is further configured to: when detecting a refresh operation of the user on the list page, acquire second application data of the application from a server through an application program interface;
  • the application local cache device 100 further includes:
  • the calculating module 105 is configured to separately calculate and compare the md5 value of the second application data and the md5 value of the local data;
  • the update module 104 is further configured to save the second application data as new local data to update the local data when the two md5 values are different;
  • the display module 103 is further configured to display the updated local data through the list page to refresh the list page.
  • the terminal detects the user's operation in real time.
  • the obtaining module 102 needs to request the server to confirm whether the current page has updated content to be displayed.
  • the obtaining module 102 will request data from the server through the API.
  • the obtaining module 102 returns data through two callback functions of the middle layer, one returns local cache data, and one returns application data of the current application returned by the server through the API (ie, second application data), when the callback function is called, first The local data is returned by the first callback.
  • the calculation module 105 compares the local data with the returned second application data.
  • the update module 104 completes the update of the local data, and then the second callback returns the update. Page data; remains unchanged if there are no updates.
  • the calculation module 105 mainly checks whether the two are consistent data by comparing the md5 values of the two. If the md5 values are different, the two are different data, and the current page needs to be updated. On the contrary, it means that the returned second application data is the same as the currently stored local data, and the current page does not need to be updated.
  • the terminal first obtains the local data display from the local, and then obtains the application data refresh of the current application from the application interface according to the refresh operation of the user, and simultaneously compares the md5 with the local data. Different, store a copy into the local localstorage, and md5 encrypt the data, and update the current page table page; the same, the application interface remains unchanged.
  • the application local cache device provided by the above embodiment can update the local data in real time through the md5 value comparison, and can save the page update while enabling the user to seamlessly see the latest data, and realize the user angle while ensuring the page update. Seamless slot page switching.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Disclosed in the present invention is a local caching method for an application program. The method comprises: when it detected that an application program list page is opened, detecting whether local data of the application program exits on a terminal; if not, obtaining first application data of the application program from a server through an application program interface, and displaying the first application data by means of the list page; and storing the first application data as local data. The present invention also provides a local caching apparatus for an application program. In the local caching method and apparatus for an application program provided in the present invention, data of a list page is locally cached, and when the list is displayed, the data can be display by accessing the local data, accordingly, the pressure on a background server is reduced to some extent, and offline access of a user is supported, and the page loading speed is increased, thereby greatly improving user experience.

Description

应用程序本地缓存方法和装置  Application local caching method and device 技术领域Technical field

本发明涉及通信技术领域,尤其涉及一种应用程序本地缓存方法和装置。The present invention relates to the field of communications technologies, and in particular, to an application local cache method and apparatus.

背景技术Background technique

近年来,移动终端(如智能手机)得到了迅猛发展,人们在享受移动终端带来的种种便利的同时,也发现移动终端在用户体验上仍存在许多不足。现有技术的移动终端,如智能手机,应用程序一般没有做本地缓存或是本地缓存是通过文件存储实现的,因此,当用户打开应用程序时,一般需要通过网络加载数据,或是通过IO操作读取存储的xml文件。读写文件IO操作耗时比较长,当读写文件操作次数过多时,每次读取文件数据会带来了较大的性能开销,占用系统资源,而从服务端返回则会因为下载速度的影响造成应用程序列表页面加载很慢,以上各种情况,都容易造成用户体验不好。In recent years, mobile terminals (such as smart phones) have developed rapidly. While enjoying the convenience brought by mobile terminals, people also find that mobile terminals still have many shortcomings in user experience. In a prior art mobile terminal, such as a smart phone, an application generally does not have a local cache or a local cache is implemented by a file storage. Therefore, when a user opens an application, it generally needs to load data through the network or through an IO operation. Read the stored xml file. Reading and writing file IO operations take a long time. When the number of operations for reading and writing files is too many, each time the file data is read, it will bring a large performance overhead, occupying system resources, and returning from the server will result in download speed. The impact of the application list page loading is very slow, and the above various situations are likely to cause a bad user experience.

基于此,有必要提供一种应用程序本地缓存方法和装置,以解决当前应用程序页面加载时存在速度较慢、资源开销较大的问题。Based on this, it is necessary to provide an application local caching method and device to solve the problem that the current application page is loaded with a slower speed and a larger resource overhead.

技术问题technical problem

本发明的主要目的在于解决现有技术在应用程序页面加载时存在速度较慢、资源开销较大的技术问题。The main purpose of the present invention is to solve the technical problem that the prior art has a slower speed and a larger resource overhead when the application page is loaded.

技术解决方案Technical solution

为实现上述目的,本发明提供的一种应用程序本地缓存方法,所述方法包括:To achieve the above objective, the present invention provides an application local caching method, the method comprising:

当侦测到应用程序列表页面被打开时,检测终端是否存在所述应用程序的本地数据;When detecting that the application list page is opened, detecting whether the terminal has local data of the application;

若不存在,则通过应用程序接口从服务器获取所述应用程序的第一应用数据,通过所述列表页面展示所述第一应用数据;If the data does not exist, the first application data of the application is obtained from the server through the application program interface, and the first application data is displayed by using the list page;

保存所述第一应用数据作为所述本地数据。The first application data is saved as the local data.

优选地,所述当侦测到应用程序列表页面被打开时,检测终端是否存在所述应用程序的本地数据之后,所述方法还包括:Preferably, after detecting that the application list page is opened, detecting whether the terminal has local data of the application, the method further includes:

若存在,则获取所述本地数据并通过所述列表页面展示所述本地数据。If so, the local data is obtained and the local data is presented through the list page.

优选地,所述方法还包括:Preferably, the method further includes:

当侦测到用户在所述列表页面上的刷新操作时,通过应用程序接口从服务器获取所述应用程序的第二应用数据;When detecting a refresh operation of the user on the list page, acquiring second application data of the application from a server through an application program interface;

分别计算所述第二应用数据的md5值和所述本地数据的md5值并进行对比;Calculating and comparing the md5 value of the second application data and the md5 value of the local data respectively;

若两个md5值不同,则将所述第二应用数据保存为新的本地数据以更新所述本地数据;If the two md5 values are different, saving the second application data as new local data to update the local data;

通过所述列表页面展示更新后的所述本地数据以刷新列表页面。The updated local data is displayed through the list page to refresh the list page.

优选地,所述当侦测到应用程序列表页面被打开时,检测终端是否存在所述应用程序的本地数据之前,所述方法还包括:Preferably, before the detecting that the application list page is opened, detecting whether the terminal has local data of the application, the method further includes:

从所述终端内存空间划分出本地缓存空间,用于存储所述应用程序的本地数据。A local cache space is allocated from the terminal memory space for storing local data of the application.

优选地,所述本地数据缓存方式为localStorage,所述本地缓存空间为localStorage空间。Preferably, the local data cache mode is localStorage, and the local cache space is a localStorage space.

此外,为实现上述目的,本发明还提供应用程序本地缓存装置,包括:In addition, to achieve the above object, the present invention further provides an application local cache device, including:

检测模块,用于当侦测到应用程序列表页面被打开时,检测终端是否存在所述应用程序的本地数据;a detecting module, configured to detect, when the application list page is opened, whether the terminal has local data of the application;

获取模块,用于当不存在所述本地数据时,则通过应用程序接口从服务器获取所述应用程序的第一应用数据;An obtaining module, configured to acquire first application data of the application from a server through an application program interface when the local data does not exist;

展示模块,用于通过所述列表页面展示所述第一应用数据;a display module, configured to display the first application data by using the list page;

更新模块,用于保存所述第一应用数据作为所述本地数据。And an update module, configured to save the first application data as the local data.

优选地,其特征在于:Preferably, it is characterized by:

所述获取模块还用于当存在所述本地数据时,获取所述本地数据;The obtaining module is further configured to acquire the local data when the local data exists;

所述展示模块还用于通过所述列表页面展示所述本地数据。The presentation module is further configured to display the local data through the list page.

优选地,所述获取模块还用于当侦测到用户在所述列表页面上的刷新操作时,通过应用程序接口从服务器获取所述应用程序的第二应用数据;Preferably, the obtaining module is further configured to: when detecting a refresh operation of the user on the list page, acquire second application data of the application from a server through an application program interface;

对应的,所述应用程序本地缓存装置还包括:Correspondingly, the application local cache device further includes:

计算模块,用于分别计算所述第二应用数据的md5值和所述本地数据的md5值并进行对比;a calculation module, configured to separately calculate and compare the md5 value of the second application data and the md5 value of the local data;

所述更新模块还用于当两个md5值不同时,将所述第二应用数据保存为新的本地数据以更新所述本地数据;The update module is further configured to save the second application data as new local data to update the local data when the two md5 values are different;

所述展示模块还用于通过所述列表页面展示更新后的所述本地数据以刷新列表页面。The display module is further configured to display the updated local data through the list page to refresh the list page.

优选地,应用程序本地缓存装置还包括:Preferably, the application local cache device further includes:

划分模块,用于从所述终端内存空间划分出本地缓存空间,用于存储所述应用程序的本地数据。And a dividing module, configured to divide a local cache space from the terminal memory space, and store local data of the application.

优选地,所述本地数据缓存方式为localStorage,所述本地缓存空间为localStorage空间。Preferably, the local data cache mode is localStorage, and the local cache space is a localStorage space.

有益效果Beneficial effect

本发明所提供的应用程序本地缓存方法和装置,当侦测到应用程序列表页面被打开时,检测终端是否存在所述应用程序的本地数据;若不存在,则通过应用程序接口从服务器获取所述应用程序的第一应用数据,通过所述列表页面展示所述第一应用数据;保存所述第一应用数据作为所述本地数据。由此,将列表页面的数据缓存至本地,列表显示时通过访问本地数据即可实现展示,在一定程度上减少了后端服务器的压力,同时支持了用户离线访问以及提高了页面加载速度,极大的提高了用户体验。The application local caching method and apparatus provided by the present invention, when detecting that the application list page is opened, detecting whether the terminal has local data of the application; if not, acquiring the local device from the server through the application program interface Determining the first application data of the application, displaying the first application data through the list page; and saving the first application data as the local data. As a result, the data of the list page is cached locally, and the display can be realized by accessing the local data when the list is displayed, which reduces the pressure of the back-end server to a certain extent, and supports the offline access of the user and improves the page loading speed. Greatly improved the user experience.

附图说明DRAWINGS

图1为本发明的应用程序本地缓存方法第一实施例的流程示意图;1 is a schematic flowchart of a first embodiment of an application local cache method according to the present invention;

图2为本发明的应用程序本地缓存方法第二实施例的流程示意图;2 is a schematic flowchart of a second embodiment of an application local cache method according to the present invention;

图3为本发明的应用程序本地缓存装置第一实施例的功能模块示意图;3 is a schematic diagram of functional modules of a first embodiment of an application local cache device according to the present invention;

图4为本发明的应用程序本地缓存装置第二实施例的功能模块示意图。4 is a schematic diagram of functional modules of a second embodiment of an application local cache device of the present invention.

本发明目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The implementation, functional features, and advantages of the present invention will be further described in conjunction with the embodiments.

本发明的实施方式Embodiments of the invention

应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。It is understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

需要说明的是,在本发明各实施例中,终端包括但不限于IPAD、手机等移动终端。It should be noted that, in various embodiments of the present invention, the terminal includes, but is not limited to, a mobile terminal such as an IPAD or a mobile phone.

本发明提供一种应用程序本地缓存方法。参照图1,图1为本发明的应用程序本地缓存方法第一实施例的流程示意图。在该实施例中,所述应用程序本地缓存方法包括:The invention provides an application local caching method. Referring to FIG. 1, FIG. 1 is a schematic flowchart diagram of a first embodiment of an application local cache method according to the present invention. In this embodiment, the application local caching method includes:

步骤S10,当侦测到应用程序列表页面被打开时,检测终端是否存在所述应用程序的本地数据;Step S10, when detecting that the application list page is opened, detecting whether the terminal has local data of the application;

具体的,一般而言,应用程序都需要对用户进行验证,对于需要验证登录的应用程序,用户打开应用程序并成功登录后,接下来,应用程序需要向用户展示默认列表页面,或者用户可以自行选择某一列表页面打开。当终端侦测到应用程序的某一个列表页面被打开时,需要加载该页面,此时终端需要获取页面数据,首先检测本地存储空间中是否存在该应用程序的本地数据。Specifically, in general, the application needs to verify the user. For the application that needs to verify the login, after the user opens the application and successfully logs in, the application needs to display the default list page to the user, or the user can Select a list page to open. When the terminal detects that a certain list page of the application is opened, the page needs to be loaded. At this time, the terminal needs to acquire the page data, and firstly detects whether the local data of the application exists in the local storage space.

进一步的,在本实施例中,在步骤S10之前,所述方法还包括以下步骤:Further, in this embodiment, before step S10, the method further includes the following steps:

从所述终端内存空间划分出本地缓存空间,用于存储所述应用程序的本地数据。A local cache space is allocated from the terminal memory space for storing local data of the application.

具体的,从终端内存空间中划分出一定大小的本地缓存空间用来存储终端上应用程序缓存到本地的本地数据。可以理解的是,在该本地缓存空间中,存储有不只一个应用程序的本地数据。各应用程序与其对应的本地数据的存储位置之间可以通过映射表记录,当需要获取或检测某一应用程序对应的本地数据时,可以从映射表中得到其对应的本地数据的存储位置从而找到该本地数据。数据本地缓存的存储方式包括但不限于localStorage、websql、sqllite等,在本发明各实施例中,优选采用HTML5下的localStorage方式,对应的,本发明各实施例中,所述本地缓存空间优选为localStorage空间。Specifically, a local cache space of a certain size is allocated from the terminal memory space for storing local data cached by the application on the terminal to the local. It can be understood that in the local cache space, local data of more than one application is stored. The storage location of each application and its corresponding local data can be recorded through a mapping table. When local data corresponding to an application needs to be acquired or detected, the storage location of the corresponding local data can be obtained from the mapping table to find The local data. The storage mode of the data local cache includes, but is not limited to, local storage, websql, sqllite, and the like. In the embodiments of the present invention, the local storage method of the HTML5 is preferably used. In each embodiment of the present invention, the local cache space is preferably localStorage space.

相比于文件存储方式时每次读写文件时IO耗时比较长,当读写文件操作过多,数据量过大的时候会影响终端性能,通过localStorage等方式实现的本地缓存在支持用户离线访问的同时,也避免了多次读取的耗时以及性能损耗,更好提升了页面加载的流畅度,为用户带来了更好的体验。Compared with the file storage mode, each time the file is read or written, the IO takes a long time. When the file is read and written too much, the data is too large, which will affect the performance of the terminal. The local cache implemented by localStorage is offline. At the same time, it also avoids the time-consuming and performance loss of multiple readings, which improves the smoothness of page loading and brings a better experience for users.

步骤S20,若不存在,则通过应用程序接口从服务器获取所述应用程序的第一应用数据,通过所述列表页面展示所述第一应用数据;Step S20, if not, acquiring the first application data of the application from the server through the application program interface, and displaying the first application data by using the list page;

步骤S30,保存所述第一应用数据作为所述本地数据。Step S30, saving the first application data as the local data.

具体的,当终端本地不存在应用程序的本地数据时,则该应用程序可能是首次使用或是用户执行了清空缓存操作,因此,此次显示的数据需要从服务器获取,此时终端通过应用程序接口(Application Programming Interface,应用程序编程接口,API,简称应用程序接口)向服务器提出数据请求并接收服务器返回的该应用程序第一应用数据,该第一应用数据将被保存到本地缓存空间中作为该应用程序的本地数据。此时,终端获取到列表页面显示所需要的数据,可以通过列表页面展示该第一应用数据。Specifically, when the local data of the application does not exist locally, the application may be used for the first time or the user performs an empty cache operation. Therefore, the data displayed this time needs to be obtained from the server, and the terminal passes the application. Interface Programming Interface, application programming interface (API, API for short) is a data request to the server and receives the first application data of the application returned by the server, and the first application data is saved in the local cache space as the application. Local data. At this time, the terminal obtains the data required for the list page display, and the first application data can be displayed through the list page.

可以理解的是,此处,从服务器获取的应用数据主要指应用程序用于显示列表页面所需要的数据,包括但不限于音频数据、视频数据、图片数据以及文本数据。It can be understood that, here, the application data acquired from the server mainly refers to data required by the application for displaying the list page, including but not limited to audio data, video data, picture data, and text data.

需要说明的是,此处,缓存的本地数据一般为应用程序当前一个页面的数据。例如,对于列表页面而言,一般仅需保存当前一个列表页面的数据即可,翻页的页面数据无需缓存。It should be noted that here, the cached local data is generally the data of one page of the current application. For example, for a list page, generally only the data of the current list page needs to be saved, and the page data of the page turning does not need to be cached.

可以理解的是,在本发明各实施例中,本地数据的保存可以通过md5(Message Digest Algorithm 5,MD5,消息摘要算法第五版,简称摘要算法)加密保存,以确保数据完整。It can be understood that in various embodiments of the present invention, local data can be saved by md5 (Message Digest) Algorithm 5, MD5, Message Digest Algorithm Fifth Edition, abbreviated Abstract Algorithm) is encrypted to ensure data integrity.

步骤S40,若存在,则获取所述本地数据并通过所述列表页面展示所述本地数据。Step S40, if yes, acquiring the local data and displaying the local data through the list page.

具体的,当此次打开应用数据不是第一次或是之前用户未执行清空缓存操作时,则本地缓存空间中一般都存储有该应用程序对应的本地数据。当终端本地存储有该应用程序对应的本地数据时,则终端可以直接获取该本地数据,加载该列表页面并展示该本地数据,例如,显示相关的图片文字或是视频数据。在该列表页面上,用户可以点击相应的图片或是文字链接等,打开新的列表页面。用户也可以通过刷新操作例如下拉或点击刷新按钮等刷新当前列表页面,更新页面内容。Specifically, when the application data is not opened for the first time or the user does not perform the flushing operation before, the local data corresponding to the application is generally stored in the local cache space. When the terminal locally stores the local data corresponding to the application, the terminal may directly acquire the local data, load the list page, and display the local data, for example, display related picture text or video data. On the list page, the user can click on the corresponding picture or text link to open a new list page. The user can also refresh the current list page by refreshing operations such as pulling down or clicking a refresh button to update the page content.

以上实施例提供的应用程序本地缓存方法,当侦测到应用程序列表页面被打开时,检测终端是否存在所述应用程序的本地数据;若不存在,则通过应用程序接口从服务器获取所述应用程序的第一应用数据,通过所述列表页面展示所述第一应用数据;保存所述第一应用数据作为所述本地数据。由此,将列表页面的数据缓存至本地,列表显示时通过访问本地数据即可实现展示,在一定程度上减少了后端服务器的压力,同时支持了用户离线访问以及提高了页面加载速度,极大的提高了用户体验。The application local caching method provided by the above embodiment detects whether the terminal has local data of the application when it is detected that the application list page is opened; if not, the application is obtained from the server through the application program interface. a first application data of the program, the first application data is displayed through the list page; and the first application data is saved as the local data. As a result, the data of the list page is cached locally, and the display can be realized by accessing the local data when the list is displayed, which reduces the pressure of the back-end server to a certain extent, and supports the offline access of the user and improves the page loading speed. Greatly improved the user experience.

进一步的,请参考图2,图2为本发明的应用程序本地缓存方法第二实施例的流程示意图。与应用程序本地缓存方法第一实施例的区别在于,在本实施例中,除步骤S10-S40(未重复示出)之外,所述方法还包括:Further, please refer to FIG. 2. FIG. 2 is a schematic flowchart diagram of a second embodiment of an application local cache method according to the present invention. The difference from the first embodiment of the application local caching method is that, in this embodiment, in addition to steps S10-S40 (not shown again), the method further includes:

步骤S50,当侦测到用户在所述列表页面上的刷新操作时,通过应用程序接口从服务器获取所述应用程序的第二应用数据;Step S50, when detecting a refresh operation of the user on the list page, acquiring second application data of the application from a server through an application program interface;

步骤S60,分别计算所述第二应用数据的md5值和所述本地数据的md5值并进行对比;Step S60, respectively calculating the md5 value of the second application data and the md5 value of the local data, and comparing the values;

步骤S70,若两个md5值不同,则将所述第二应用数据保存为新的本地数据以更新所述本地数据;Step S70, if the two md5 values are different, saving the second application data as new local data to update the local data;

步骤S80,通过所述列表页面展示更新后的所述本地数据以刷新列表页面。Step S80, displaying the updated local data through the list page to refresh the list page.

具体的,在列表页面显示时,终端实时侦测用户的操作,当侦测到用户的刷新操作时,此时,需要向服务器请求以确认当前页面是否有更新的内容需要显示。详细的,每次用户刷新页面时,终端都将通过API向服务器请求数据。终端通过中间层的两个回调函数来返回数据,一个返回本地缓存数据,一个返回服务器通过API返回的当前应用程序的应用数据(即第二应用数据),当调用回调函数的时候,首先通过第一次回调返回本地数据,当服务器请求返回后,对比本地数据和返回的第二应用数据,如果有更新,完成更新本地数据,然后第二次回调返回更新页面数据;如果没有更新,则保持不变。对比本地数据和返回的第二应用数据时,主要通过对比两者的md5值确认两者是否为一致的数据,若md5值不同,则说明两者为不同的数据,当前页面需要更新,反之,则说明返回的第二应用数据与当前本地存储的本地数据相同,当前页面无需更新。Specifically, when the list page is displayed, the terminal detects the user's operation in real time. When the user's refresh operation is detected, at this time, the server needs to request to confirm whether the current page has updated content to be displayed. In detail, each time the user refreshes the page, the terminal will request data from the server through the API. The terminal returns data through two callback functions of the middle layer, one returns local cache data, and one returns the application data of the current application returned by the server through the API (ie, the second application data). When the callback function is called, the first pass A callback returns local data. When the server requests a return, it compares the local data with the returned second application data. If there is an update, the local data is updated, and then the second callback returns the updated page data; if there is no update, it remains unchanged. change. When comparing the local data and the returned second application data, it is mainly confirmed by comparing the md5 values of the two whether the two are consistent data. If the md5 values are different, the two are different data, and the current page needs to be updated, and vice versa. The second application data returned is the same as the local data currently stored locally, and the current page does not need to be updated.

以下通过一个实际场景举例说明实际应用中应用程序本地缓存数据的更新过程:The following is an actual scenario to illustrate the update process of the application's local cache data in the actual application:

(1)、用户访问某一个列表页面。(1) The user accesses a certain list page.

(2)、终端首先从本地获取本地数据展现,然后根据用户的刷新操作从应用程序接口获取当前应用程序的应用数据刷新,同时和本地数据进行md5的对比。不同,就存储一份到本地的localstorage里,并对该数据进行md5加密,同时更新当前页表页面;相同,则应用程序界面不变。(2) The terminal first obtains the local data presentation from the local, and then obtains the application data refresh of the current application from the application interface according to the refresh operation of the user, and simultaneously compares the md5 with the local data. Different, store a copy into the local localstorage, and md5 encrypt the data, and update the current page table page; the same, the application interface remains unchanged.

如此,在加载页面时,用户首先看到的是已经缓存好的本地数据,因此,加载速度非常快,而通过md5实现数据保存和更新,则可以保证数据传输的一致性和完整性。In this way, when the page is loaded, the user first sees the cached local data, so the loading speed is very fast, and the data storage and update through md5 can ensure the consistency and integrity of the data transmission.

以上实施例提供的应用程序本地缓存方法,通过md5值比对实时更新本地数据,在保存页面更新的同时也能够使用户无缝隙的看到最新数据,在保证页面更新的同时实现了用户角度的无缝隙页面切换。The application local caching method provided by the above embodiment can update the local data in real time through the md5 value comparison, and can save the page update while enabling the user to seamlessly see the latest data, and realize the user angle while ensuring the page update. Seamless slot page switching.

本发明提供一种应用程序本地缓存装置。参照图4,图4为本发明的鼠标应用程序本地缓存装置第一实施例的功能模块示意图。在该实施例中,应用程序本地缓存装置100应用于终端中,包括:The invention provides an application local caching device. Referring to FIG. 4, FIG. 4 is a schematic diagram of functional modules of a first embodiment of a mouse application local cache device according to the present invention. In this embodiment, the application local cache device 100 is applied to the terminal, and includes:

检测模块101,用于当侦测到应用程序列表页面被打开时,检测终端是否存在所述应用程序的本地数据;The detecting module 101 is configured to detect, when the application list page is opened, whether the terminal has local data of the application;

具体的,一般而言,应用程序都需要对用户进行验证,对于需要验证登录的应用程序,用户打开应用程序并成功登录后,接下来,应用程序需要向用户展示默认列表页面,或者用户可以自行选择某一列表页面打开。当终端侦测到应用程序的某一个列表页面被打开时,需要加载该页面,此时终端需要获取页面数据,检测模块101首先检测本地存储空间中是否存在该应用程序的本地数据。Specifically, in general, the application needs to verify the user. For the application that needs to verify the login, after the user opens the application and successfully logs in, the application needs to display the default list page to the user, or the user can Select a list page to open. When the terminal detects that a certain list page of the application is opened, the page needs to be loaded. At this time, the terminal needs to acquire the page data, and the detecting module 101 first detects whether the local data of the application exists in the local storage space.

进一步的,在本实施例中,应用程序本地缓存装置100还包括:Further, in this embodiment, the application local cache device 100 further includes:

划分模块106,用于从所述终端内存空间划分出本地缓存空间,用于存储所述应用程序的本地数据。The dividing module 106 is configured to divide a local cache space from the terminal memory space for storing local data of the application.

具体的,划分模块106从终端内存空间中划分出一定大小的本地缓存空间用来存储终端上应用程序缓存到本地的本地数据。可以理解的是,在该本地缓存空间中,存储有不只一个应用程序的本地数据。各应用程序与其对应的本地数据的存储位置之间可以通过映射表记录,当需要获取或检测某一应用程序对应的本地数据时,可以从映射表中得到其对应的本地数据的存储位置从而找到该本地数据。数据本地缓存的存储方式包括但不限于localStorage、websql、sqllite等,在本发明各实施例中,优选采用HTML5下的localStorage方式,对应的,本发明各实施例中,所述本地缓存空间优选为localStorage空间。Specifically, the dividing module 106 divides a certain size of the local cache space from the terminal memory space for storing the local data cached by the application on the terminal to the local. It can be understood that in the local cache space, local data of more than one application is stored. The storage location of each application and its corresponding local data can be recorded through a mapping table. When local data corresponding to an application needs to be acquired or detected, the storage location of the corresponding local data can be obtained from the mapping table to find The local data. The storage mode of the data local cache includes, but is not limited to, local storage, websql, sqllite, and the like. In the embodiments of the present invention, the local storage method of the HTML5 is preferably used. In each embodiment of the present invention, the local cache space is preferably localStorage space.

相比于文件存储方式时每次读写文件时IO耗时比较长,当读写文件操作过多,数据量过大的时候会影响终端性能,通过localStorage等方式实现的本地缓存在支持用户离线访问的同时,也避免了多次读取的耗时以及性能损耗,更好提升了页面加载的流畅度,为用户带来了更好的体验。Compared with the file storage mode, each time the file is read or written, the IO takes a long time. When the file is read and written too much, the data is too large, which will affect the performance of the terminal. The local cache implemented by localStorage is offline. At the same time, it also avoids the time-consuming and performance loss of multiple readings, which improves the smoothness of page loading and brings a better experience for users.

获取模块102,用于当不存在所述本地数据时,则通过应用程序接口从服务器获取所述应用程序的第一应用数据并保存为所述本地数据;The obtaining module 102 is configured to: when the local data does not exist, obtain the first application data of the application from the server through the application program interface and save the data as the local data;

展示模块103,用于通过所述列表页面展示所述第一应用数据;The display module 103 is configured to display the first application data by using the list page;

更新模块104,用于保存所述第一数据作为所述本地数据。The update module 104 is configured to save the first data as the local data.

具体的,当终端本地不存在应用程序的本地数据时,则该应用程序可能是首次使用或是用户执行了清空缓存操作,因此,此次显示的数据需要从服务器获取,此时获取模块102,通过应用程序接口(API)向服务器提出数据请求并接收服务器返回的该应用程序的第一应用数据,该第一应用数据将被更新模块104保存到本地缓存空间中作为该应用程序的本地数据。此时,获取模块102获取到列表页面显示所需要的数据,展示模块103可以通过列表页面展示该第一应用数据。Specifically, when the local data of the application does not exist locally in the terminal, the application may be used for the first time or the user performs the clearing cache operation. Therefore, the data displayed this time needs to be acquired from the server, and the module 102 is acquired at this time. A data request is made to the server through an application program interface (API) and the first application data of the application returned by the server is received, and the first application data is saved by the update module 104 into the local cache space as local data of the application. At this time, the obtaining module 102 obtains the data required for the display of the list page, and the display module 103 can display the first application data through the list page.

可以理解的是,此处,从服务器获取的应用数据主要指应用程序用于显示列表页面所需要的数据,包括但不限于音频数据、视频数据、图片数据以及文本数据。It can be understood that, here, the application data acquired from the server mainly refers to data required by the application for displaying the list page, including but not limited to audio data, video data, picture data, and text data.

需要说明的是,此处,缓存的本地数据一般为应用程序当前一个页面的数据。例如,对于列表页面而言,一般仅需保存当前一个列表页面的数据即可,翻页的页面数据无需缓存。It should be noted that here, the cached local data is generally the data of one page of the current application. For example, for a list page, generally only the data of the current list page needs to be saved, and the page data of the page turning does not need to be cached.

可以理解的是,在本发明各实施例中,本地数据的保存可以通过md5加密保存,以确保数据完整。It can be understood that in various embodiments of the present invention, the preservation of local data can be saved by md5 encryption to ensure data integrity.

获取模块102还用于当存在所述本地数据时获取所述本地数据;The obtaining module 102 is further configured to acquire the local data when the local data exists;

展示模块103还用于通过所述列表页面展示所述本地数据。The presentation module 103 is further configured to display the local data through the list page.

具体的,当此次打开应用数据不是第一次或是之前用户未执行清空缓存操作时,则本地缓存空间中一般都存储有该应用程序对应的本地数据。当终端本地存储有该应用程序对应的本地数据时,则获取模块102可以直接获取该本地数据,展示模块103加载该列表页面并展示该本地数据,例如,显示相关的图片文字或是视频数据。在该列表页面上,用户可以点击相应的图片或是文字链接等,打开新的列表页面。用户也可以通过刷新操作例如下拉或点击刷新按钮等刷新当前列表页面,更新页面内容。Specifically, when the application data is not opened for the first time or the user does not perform the flushing operation before, the local data corresponding to the application is generally stored in the local cache space. When the terminal locally stores the local data corresponding to the application, the obtaining module 102 can directly obtain the local data, and the display module 103 loads the list page and displays the local data, for example, displaying related picture text or video data. On the list page, the user can click on the corresponding picture or text link to open a new list page. The user can also refresh the current list page by refreshing operations such as pulling down or clicking a refresh button to update the page content.

以上实施例提供的应用程序本地缓存装置,当侦测到应用程序列表页面被打开时,检测终端是否存在所述应用程序的本地数据;若不存在,则通过应用程序接口从服务器获取所述应用程序的第一应用数据,通过所述列表页面展示所述第一应用数据;保存所述第一应用数据作为所述本地数据。由此,将列表页面的数据缓存至本地,列表显示时通过访问本地数据即可实现展示,在一定程度上减少了后端服务器的压力,同时支持了用户离线访问以及提高了页面加载速度,极大的提高了用户体验。The application local cache device provided by the above embodiment detects whether the terminal has local data of the application when it is detected that the application list page is opened; if not, the application is obtained from the server through the application program interface. a first application data of the program, the first application data is displayed through the list page; and the first application data is saved as the local data. As a result, the data of the list page is cached locally, and the display can be realized by accessing the local data when the list is displayed, which reduces the pressure of the back-end server to a certain extent, and supports the offline access of the user and improves the page loading speed. Greatly improved the user experience.

进一步的,请参考图4,图4为本发明的应用程序本地缓存方法第二实施例的功能模块示意图。与应用程序本地缓存装置第一实施例的区别在于,在本实施例中:Further, please refer to FIG. 4. FIG. 4 is a schematic diagram of functional modules of a second embodiment of an application local cache method according to the present invention. The difference from the first embodiment of the application local caching device is that in this embodiment:

获取模块102还用于当侦测到用户在所述列表页面上的刷新操作时,通过应用程序接口从服务器获取所述应用程序的第二应用数据;The obtaining module 102 is further configured to: when detecting a refresh operation of the user on the list page, acquire second application data of the application from a server through an application program interface;

对应的,应用程序本地缓存装置100还包括:Correspondingly, the application local cache device 100 further includes:

计算模块105,用于分别计算所述第二应用数据的md5值和所述本地数据的md5值并进行对比;The calculating module 105 is configured to separately calculate and compare the md5 value of the second application data and the md5 value of the local data;

更新模块104还用于当两个md5值不同时,将所述第二应用数据保存为新的本地数据以更新所述本地数据;The update module 104 is further configured to save the second application data as new local data to update the local data when the two md5 values are different;

展示模块103还用于通过所述列表页面展示更新后的所述本地数据以刷新列表页面。The display module 103 is further configured to display the updated local data through the list page to refresh the list page.

具体的,在列表页面显示时,终端实时侦测用户的操作,当侦测到用户的刷新操作时,此时,获取模块102需要向服务器请求以确认当前页面是否有更新的内容需要显示。详细的,每次用户刷新页面时,获取模块102都将通过API向服务器请求数据。获取模块102通过中间层的两个回调函数来返回数据,一个返回本地缓存数据,一个返回服务器通过API返回的当前应用程序的应用数据(即第二应用数据),当调用回调函数的时候,首先通过第一次回调返回本地数据,当服务器请求返回后,计算模块105对比本地数据和返回的第二应用数据,如果有更新,则由更新模块104完成更新本地数据,然后第二次回调返回更新页面数据;如果没有更新,则保持不变。对比本地数据和返回的第二应用数据时,计算模块105主要通过对比两者的md5值确认两者是否为一致的数据,若md5值不同,则说明两者为不同的数据,当前页面需要更新,反之,则说明返回的第二应用数据与当前本地存储的本地数据相同,当前页面无需更新。Specifically, when the list page is displayed, the terminal detects the user's operation in real time. When the user's refresh operation is detected, at this time, the obtaining module 102 needs to request the server to confirm whether the current page has updated content to be displayed. In detail, each time the user refreshes the page, the obtaining module 102 will request data from the server through the API. The obtaining module 102 returns data through two callback functions of the middle layer, one returns local cache data, and one returns application data of the current application returned by the server through the API (ie, second application data), when the callback function is called, first The local data is returned by the first callback. After the server requests the return, the calculation module 105 compares the local data with the returned second application data. If there is an update, the update module 104 completes the update of the local data, and then the second callback returns the update. Page data; remains unchanged if there are no updates. When the local data and the returned second application data are compared, the calculation module 105 mainly checks whether the two are consistent data by comparing the md5 values of the two. If the md5 values are different, the two are different data, and the current page needs to be updated. On the contrary, it means that the returned second application data is the same as the currently stored local data, and the current page does not need to be updated.

以下通过一个实际场景举例说明实际应用中应用程序本地缓存数据的更新过程:The following is an actual scenario to illustrate the update process of the application's local cache data in the actual application:

(1)、用户访问某一个列表页面。(1) The user accesses a certain list page.

(2)、终端首先从本地获取本地数数据展现,然后根据用户的刷新操作从应用程序接口获取当前应用程序的应用数据刷新,同时和本地数据进行md5的对比。不同,就存储一份到本地的localstorage里,并对该数据进行md5加密,同时更新当前页表页面;相同,则应用程序界面不变。(2) The terminal first obtains the local data display from the local, and then obtains the application data refresh of the current application from the application interface according to the refresh operation of the user, and simultaneously compares the md5 with the local data. Different, store a copy into the local localstorage, and md5 encrypt the data, and update the current page table page; the same, the application interface remains unchanged.

如此,在加载页面时,用户首先看到的是已经缓存好的本地数据,因此,加载速度非常快,而通过md5实现数据保存和更新,则可以保证数据传输的一致性和完整性。In this way, when the page is loaded, the user first sees the cached local data, so the loading speed is very fast, and the data storage and update through md5 can ensure the consistency and integrity of the data transmission.

以上实施例提供的应用程序本地缓存装置,通过md5值比对实时更新本地数据,在保存页面更新的同时也能够使用户无缝隙的看到最新数据,在保证页面更新的同时实现了用户角度的无缝隙页面切换。The application local cache device provided by the above embodiment can update the local data in real time through the md5 value comparison, and can save the page update while enabling the user to seamlessly see the latest data, and realize the user angle while ensuring the page update. Seamless slot page switching.

以上仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。 The above are only the preferred embodiments of the present invention, and are not intended to limit the scope of the invention, and the equivalent structure or equivalent process transformations made by the description of the present invention and the drawings are directly or indirectly applied to other related technical fields. The same is included in the scope of patent protection of the present invention.

Claims (10)

一种应用程序本地缓存方法,其特征在于,所述方法包括: An application local caching method, the method comprising: 当侦测到应用程序列表页面被打开时,检测终端是否存在所述应用程序的本地数据;When detecting that the application list page is opened, detecting whether the terminal has local data of the application; 若不存在,则通过应用程序接口从服务器获取所述应用程序的第一应用数据,通过所述列表页面展示所述第一应用数据;If the data does not exist, the first application data of the application is obtained from the server through the application program interface, and the first application data is displayed by using the list page; 保存所述第一应用数据作为所述本地数据。The first application data is saved as the local data. 根据权利要求1所述的应用程序本地缓存方法,其特征在于,所述当侦测到应用程序列表页面被打开时,检测终端是否存在所述应用程序的本地数据之后,所述方法还包括:The application local cache method according to claim 1, wherein, after detecting that the application list page is opened, detecting whether the terminal has local data of the application, the method further includes: 若存在,则获取所述本地数据并通过所述列表页面展示所述本地数据。If so, the local data is obtained and the local data is presented through the list page. 根据权利要求1或2所述的应用程序本地缓存方法,其特征在于,所述方法还包括:The application local caching method according to claim 1 or 2, wherein the method further comprises: 当侦测到用户在所述列表页面上的刷新操作时,通过应用程序接口从服务器获取所述应用程序的第二应用数据;When detecting a refresh operation of the user on the list page, acquiring second application data of the application from a server through an application program interface; 分别计算所述第二应用数据的md5值和所述本地数据的md5值并进行对比;Calculating and comparing the md5 value of the second application data and the md5 value of the local data respectively; 若两个md5值不同,则将所述第二应用数据保存为新的本地数据以更新所述本地数据;If the two md5 values are different, saving the second application data as new local data to update the local data; 通过所述列表页面展示更新后的所述本地数据以刷新列表页面。The updated local data is displayed through the list page to refresh the list page. 根据权利要求1或2所述的应用程序本地缓存方法,其特征在于,所述当侦测到应用程序列表页面被打开时,检测终端是否存在所述应用程序的本地数据之前,所述方法还包括:The application local caching method according to claim 1 or 2, wherein, when detecting that the application list page is opened, detecting whether the terminal has local data of the application, the method further include: 从所述终端内存空间划分出本地缓存空间,用于存储所述应用程序的本地数据。A local cache space is allocated from the terminal memory space for storing local data of the application. 根据权利要求4所述的应用程序本地缓存方法,其特征在于,所述本地数据缓存方式为localStorage,所述本地缓存空间为localStorage空间。The local cache method of the application according to claim 4, wherein the local data cache mode is localStorage, and the local cache space is a localStorage space. 一种应用程序本地缓存装置,其特征在于,所述应用程序本地缓存装置包括:An application local caching device, wherein the application local caching device comprises: 检测模块,用于当侦测到应用程序列表页面被打开时,检测终端是否存在所述应用程序的本地数据;a detecting module, configured to detect, when the application list page is opened, whether the terminal has local data of the application; 获取模块,用于当不存在所述本地数据时,则通过应用程序接口从服务器获取所述应用程序的第一应用数据;An obtaining module, configured to acquire first application data of the application from a server through an application program interface when the local data does not exist; 展示模块,用于通过所述列表页面展示所述第一数据;a display module, configured to display the first data by using the list page; 更新模块,用于保存所述第一应用数据作为所述本地数据。And an update module, configured to save the first application data as the local data. 根据权利要求6所述的应用程序本地缓存装置,其特征在于:The application local caching apparatus according to claim 6, wherein: 所述获取模块还用于当存在所述本地数据时,获取所述本地数据;The obtaining module is further configured to acquire the local data when the local data exists; 所述展示模块还用于通过所述列表页面展示所述本地数据。The presentation module is further configured to display the local data through the list page. 根据权利要求6或7所述的应用程序本地缓存装置,其特征在于:The application local caching device according to claim 6 or 7, wherein: 所述获取模块还用于当侦测到用户在所述列表页面上的刷新操作时,通过应用程序接口从服务器获取所述应用程序的第二应用数据;The obtaining module is further configured to: when detecting a refresh operation of the user on the list page, acquire, by using an application program interface, second application data of the application from a server; 对应的,所述应用程序本地缓存装置还包括:Correspondingly, the application local cache device further includes: 计算模块,用于分别计算所述第二应用数据的md5值和所述本地数据的md5值并进行对比;a calculation module, configured to separately calculate and compare the md5 value of the second application data and the md5 value of the local data; 所述更新模块还用于当两个md5值不同时,将所述第二应用数据保存为新的本地数据以更新所述本地数据;The update module is further configured to save the second application data as new local data to update the local data when the two md5 values are different; 所述展示模块还用于通过所述列表页面展示更新后的所述本地数据以刷新列表页面。The display module is further configured to display the updated local data through the list page to refresh the list page. 根据权利要求6或7所述的应用程序本地缓存装置,其特征在于,应用程序本地缓存装置还包括:The application local cache device according to claim 6 or 7, wherein the application local cache device further comprises: 划分模块,用于从所述终端内存空间划分出本地缓存空间,用于存储所述应用程序的本地数据。And a dividing module, configured to divide a local cache space from the terminal memory space, and store local data of the application. 根据权利要求9所述的应用程序本地缓存装置,其特征在于,所述本地数据缓存方式为localStorage,所述本地缓存空间为localStorage空间。 The application local cache device according to claim 9, wherein the local data cache mode is localStorage, and the local cache space is a localStorage space.
PCT/CN2017/076095 2017-03-09 2017-03-09 Local caching method and apparatus for application program Ceased WO2018161294A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/076095 WO2018161294A1 (en) 2017-03-09 2017-03-09 Local caching method and apparatus for application program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/076095 WO2018161294A1 (en) 2017-03-09 2017-03-09 Local caching method and apparatus for application program

Publications (1)

Publication Number Publication Date
WO2018161294A1 true WO2018161294A1 (en) 2018-09-13

Family

ID=63447076

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/076095 Ceased WO2018161294A1 (en) 2017-03-09 2017-03-09 Local caching method and apparatus for application program

Country Status (1)

Country Link
WO (1) WO2018161294A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111506644A (en) * 2019-01-31 2020-08-07 北京神州泰岳软件股份有限公司 Application data processing method and device and electronic equipment
CN113158107A (en) * 2021-04-27 2021-07-23 中国工商银行股份有限公司 Method and device for accessing notification bar message, electronic equipment and storage medium
US20220091834A1 (en) * 2020-09-23 2022-03-24 Beijing Baidu Netcom Science And Technology Co., Ltd. Method, apparatus, electronic device and readable storage medium for deploying application
CN114780559A (en) * 2022-03-30 2022-07-22 深圳市云视机器人有限公司 Application response method and device, terminal equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020083132A1 (en) * 1998-12-22 2002-06-27 Holland Ian Michael Accessing page bundles on a portable client having intermittent network connectivity
US8700804B1 (en) * 2011-03-16 2014-04-15 EP Visual Design, Inc. Methods and apparatus for managing mobile content
CN104965717A (en) * 2014-06-05 2015-10-07 腾讯科技(深圳)有限公司 Method and apparatus for loading page
CN105869005A (en) * 2015-11-23 2016-08-17 乐视网信息技术(北京)股份有限公司 APP startup advertisement pre-loading method, apparatus and system
CN106126685A (en) * 2016-06-29 2016-11-16 北京小米移动软件有限公司 Page loading method and device
CN106446174A (en) * 2016-09-28 2017-02-22 江西博瑞彤芸科技有限公司 Method for page loading in application

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020083132A1 (en) * 1998-12-22 2002-06-27 Holland Ian Michael Accessing page bundles on a portable client having intermittent network connectivity
US8700804B1 (en) * 2011-03-16 2014-04-15 EP Visual Design, Inc. Methods and apparatus for managing mobile content
CN104965717A (en) * 2014-06-05 2015-10-07 腾讯科技(深圳)有限公司 Method and apparatus for loading page
CN105869005A (en) * 2015-11-23 2016-08-17 乐视网信息技术(北京)股份有限公司 APP startup advertisement pre-loading method, apparatus and system
CN106126685A (en) * 2016-06-29 2016-11-16 北京小米移动软件有限公司 Page loading method and device
CN106446174A (en) * 2016-09-28 2017-02-22 江西博瑞彤芸科技有限公司 Method for page loading in application

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111506644A (en) * 2019-01-31 2020-08-07 北京神州泰岳软件股份有限公司 Application data processing method and device and electronic equipment
CN111506644B (en) * 2019-01-31 2024-01-23 北京神州泰岳软件股份有限公司 Application data processing method and device and electronic equipment
US20220091834A1 (en) * 2020-09-23 2022-03-24 Beijing Baidu Netcom Science And Technology Co., Ltd. Method, apparatus, electronic device and readable storage medium for deploying application
CN113158107A (en) * 2021-04-27 2021-07-23 中国工商银行股份有限公司 Method and device for accessing notification bar message, electronic equipment and storage medium
CN114780559A (en) * 2022-03-30 2022-07-22 深圳市云视机器人有限公司 Application response method and device, terminal equipment and storage medium

Similar Documents

Publication Publication Date Title
WO2018161294A1 (en) Local caching method and apparatus for application program
WO2020141660A1 (en) Electronic apparatus managing data based on block chain and method for managing data
WO2012100605A1 (en) Picture management method, mobile terminal, and computer storage medium
WO2020237849A1 (en) Snapshot read-write method for network block device, apparatus, device, and storage medium
WO2021072881A1 (en) Object storage-based request processing method, apparatus and device, and storage medium
CN108566561B (en) Video playing method, device and storage medium
WO2018103315A1 (en) Monitoring data processing method, apparatus, server and storage equipment
WO2020224246A1 (en) Block chain-based data management method and apparatus, device and storage medium
WO2021027134A1 (en) Data storage method, apparatus and device and computer storage medium
CN107168999A (en) A kind of method for updating pages and device
WO2020253120A1 (en) Webpage registration method, system and device, and computer storage medium
WO2020237859A1 (en) Data migration method employing nbd device, apparatus, device, and storage medium
WO2016137185A1 (en) Electronic device and method for providing drm content by the electronic device
WO2014192063A1 (en) Application execution program, application execution method, and information processing terminal device in which application is executed
WO2018076879A1 (en) Data backup method and apparatus, storage medium, and terminal
WO2011129635A2 (en) Method and apparatus for providing application service in a mobile communication system
WO2013024966A1 (en) Method and device for receiving content
WO2018161601A1 (en) Screen backlight adjusting method, device, storage medium and electronic device
WO2021012487A1 (en) Cross-system information synchronisation method, user device, storage medium, and apparatus
WO2017157125A1 (en) Method and apparatus for deleting cloud host in cloud computing environment, server and storage medium
WO2018049879A1 (en) Data migration method and device
WO2018076880A1 (en) Data backup method, apparatus, storage medium, and terminal
CN113407506A (en) Data processing method, device, equipment and storage medium
WO2014044131A1 (en) Contact person backup method, device and storage medium for mobile terminal
JP4241200B2 (en) Data sharing system and method, and data sharing program

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17900088

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载