CN110765383A - Resource caching method and device - Google Patents

Resource caching method and device Download PDF

Info

Publication number
CN110765383A
CN110765383A CN201911001053.4A CN201911001053A CN110765383A CN 110765383 A CN110765383 A CN 110765383A CN 201911001053 A CN201911001053 A CN 201911001053A CN 110765383 A CN110765383 A CN 110765383A
Authority
CN
China
Prior art keywords
resource
cache
caching
request information
network request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911001053.4A
Other languages
Chinese (zh)
Inventor
涂畅
董扬
康宇麟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ant Fortune Shanghai Financial Information Service Co ltd
Original Assignee
Alipay Hangzhou Information 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 Alipay Hangzhou Information Technology Co Ltd filed Critical Alipay Hangzhou Information Technology Co Ltd
Priority to CN201911001053.4A priority Critical patent/CN110765383A/en
Publication of CN110765383A publication Critical patent/CN110765383A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The present specification provides a resource caching method and device, wherein the resource caching method includes: under the condition that the user is determined to have a cache demand based on the behavior information of the user, generating a cache task according to network request information corresponding to a resource to be cached of an application program; caching the resource to be cached according to the network request information based on the caching task; analyzing the cached resource to be cached to obtain network request information corresponding to a lower-level cache resource of the resource to be cached, and generating a lower-level cache task corresponding to the lower-level cache resource; detecting whether the residual storage space in the storage space for storing the cache resources is larger than a preset space threshold value or not; and if so, caching the lower-level cache resource according to the network request information corresponding to the lower-level cache resource based on the lower-level cache task.

Description

Resource caching method and device
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a resource caching method. The present specification also relates to a resource caching apparatus, a computing device, and a computer-readable storage medium.
Background
With the development of internet technology, the functions of mobile phones are more and more intelligent, from the early stage that only calls can be carried out through mobile phones to the present, shopping, game playing, movie watching and the like can be carried out through mobile phones, so that the life becomes more and more convenient, and the mobile phones become an indispensable part of the life of users.
In the prior art, when a user needs to sit on an airplane for traveling, the carried mobile phone needs to be set to be in a flight mode or a power-off state, so as to avoid influencing the traveling of the airplane, at this time, the user cannot continue to browse the content in the application program through the mobile phone, the user can only watch and listen to the video or the sound cached to the mobile phone, and cannot browse the news information or the text information in some application programs, and therefore a solution is urgently needed to realize that the user can still browse the resources in the application program when the mobile phone is in the flight mode.
Disclosure of Invention
In view of this, embodiments of the present specification provide a resource caching method. The present specification also relates to a resource caching apparatus, a computing device, and a computer-readable storage medium, so as to solve the technical defects in the prior art.
According to a first aspect of embodiments of the present specification, there is provided a resource caching method, including:
under the condition that the user is determined to have a cache demand based on the behavior information of the user, generating a cache task according to network request information corresponding to a resource to be cached of an application program;
caching the resource to be cached according to the network request information based on the caching task;
analyzing the cached resource to be cached to obtain network request information corresponding to a lower-level cache resource of the resource to be cached, and generating a lower-level cache task corresponding to the lower-level cache resource;
detecting whether the residual storage space in the storage space for storing the cache resources is larger than a preset space threshold value or not;
and if so, caching the lower-level cache resource according to the network request information corresponding to the lower-level cache resource based on the lower-level cache task.
Optionally, the analyzing the resource to be cached after the caching is completed, obtaining the network request information corresponding to the subordinate caching resource of the resource to be cached, and generating a subordinate caching task corresponding to the subordinate caching resource, includes:
taking the cached resource to be cached as a first-level cache resource and analyzing the first-level cache resource to obtain second-level network request information corresponding to a second-level cache resource contained in the first-level cache resource;
generating a second-level cache task corresponding to the second-level cache resource according to the second-level network request information;
correspondingly, the caching the subordinate cache resource according to the network request information corresponding to the subordinate cache resource based on the subordinate cache task includes:
and caching the second-level cache resources according to the second-level network request information based on the second-level cache task.
Optionally, after the step of caching the lower level cache resource based on the lower level cache task according to the network request information corresponding to the lower level cache resource is executed, the method further includes:
analyzing the cached second-level cache resources to obtain third-level network request information corresponding to third-level cache resources contained in the second-level cache resources;
generating a third-level cache task corresponding to the third-level cache resource according to the third-level network request information;
detecting whether the residual storage space in the storage space after the second-level cache resources are stored is larger than the preset space threshold value;
if so, caching the third-level cache resource according to the third-level network request information based on the third-level cache task.
Optionally, after the step of caching the lower level cache resource based on the lower level cache task according to the network request information corresponding to the lower level cache resource is executed, the method further includes:
constructing a mapping relation table of cache resources and corresponding network request information according to the completed cache task;
under the condition that a browsing cache instruction submitted by the user through the application program is received, triggering and clicking network request information according to the browsing cache instruction;
determining cache resources corresponding to the click network request information by inquiring the mapping relation table;
and extracting cache resources corresponding to the click network request information from the storage space and displaying the cache resources to the user by using the application program.
Optionally, after the step of extracting the cache resource corresponding to the click network request information from the storage space and performing the displaying step to the user through the application program is executed, the method further includes:
screening out cache resources which are displayed by the application program from the storage space;
and deleting the cache resources which are exposed and completed by the application program.
Optionally, the specific implementation manner of determining that the user has the cache demand according to the behavior information is as follows:
determining the travel information of the user according to the behavior information;
obtaining the travel starting time of the user by analyzing the travel information;
and under the condition that the time difference value between the current time and the travel starting time is smaller than a preset time threshold, determining that the user has a cache demand.
Optionally, the specific implementation manner of determining that the user has the cache demand according to the behavior information is as follows:
determining the travel information and the position information of the user according to the behavior information;
obtaining a travel starting time and a travel path of the user by analyzing the travel information, and obtaining a geographical position of the user by analyzing the position information;
determining that the user has a cache demand if the geographic location is an originating location of the travel path and a current time is not up to the travel start time.
Optionally, after the step of caching the lower level cache resource based on the lower level cache task according to the network request information corresponding to the lower level cache resource is executed, the method further includes:
determining a trip end time of the user by analyzing the trip information;
and deleting the cache resources in the storage space under the condition that the current time exceeds the travel end time and the geographic position is the end position of the travel path.
Optionally, the generating a caching task according to the network request information corresponding to the resource to be cached of the application program includes:
acquiring attribute information of the user;
selecting a cache resource matched with the attribute information from the application program as the resource to be cached;
and generating the caching task according to the network request information corresponding to the resource to be cached.
Optionally, the analyzing the resource to be cached after the caching is completed, obtaining the network request information corresponding to the subordinate caching resource of the resource to be cached, and generating a subordinate caching task corresponding to the subordinate caching resource, includes:
analyzing the cached resources to be cached to obtain preferred network request information corresponding to preferred cache resources matched with the attribute information in the resources to be cached;
generating a preferred caching task corresponding to the preferred caching resource according to the preferred network request information;
correspondingly, the caching the subordinate cache resource according to the network request information corresponding to the subordinate cache resource based on the subordinate cache task includes:
and caching the preferred caching resource according to the preferred network request information based on the preferred caching task.
Optionally, after the step of caching the lower level cache resource based on the lower level cache task according to the network request information corresponding to the lower level cache resource is executed, the method further includes:
analyzing the cached preferable cache resources to obtain next-level network request information corresponding to next-level cache resources contained in the preferable cache resources;
judging whether the next-level network request information reaches a preset cache depth threshold value;
if yes, selecting suboptimal network request information corresponding to suboptimal cache resources matched with the attribute information from the cached resources to be cached;
generating a suboptimal cache task corresponding to the suboptimal cache resource according to the suboptimal network request information;
correspondingly, caching the subordinate cache resource according to the network request information corresponding to the subordinate cache resource based on the subordinate cache task, including:
and caching the suboptimal cache resources according to the suboptimal network request information based on the suboptimal cache task.
Optionally, after the step of generating a caching task according to the network request information corresponding to the resource to be cached of the application program is executed and before the step of caching the resource to be cached according to the network request information based on the caching task is executed under the condition that it is determined that the user has a caching requirement based on the behavior information of the user, the method further includes:
converting the network request information corresponding to the resource to be cached to obtain a cache identifier corresponding to the resource to be cached, and adding the cache identifier to a cache queue;
and under the condition that the cache identification is detected to exist in the cache queue, determining the network request information according to the cache identification, and executing the step of caching the resource to be cached according to the network request information based on the cache task.
According to a second aspect of embodiments of the present specification, there is provided a resource caching apparatus, including:
the cache task generation module is configured to generate a cache task according to network request information corresponding to a resource to be cached of an application program under the condition that the user is determined to have a cache requirement based on behavior information of the user;
a resource caching module configured to cache the resource to be cached according to the network request information based on the caching task;
the resource module to be cached is configured to parse the cached resource to be cached, obtain network request information corresponding to a lower-level cache resource of the resource to be cached, and generate a lower-level cache task corresponding to the lower-level cache resource;
a storage space detection module configured to detect whether a remaining storage space in a storage space storing the cache resource is greater than a preset space threshold;
if yes, operating a cache lower-level cache resource module;
the lower-level cache resource caching module is configured to cache the lower-level cache resource according to the network request information corresponding to the lower-level cache resource based on the lower-level cache task.
Optionally, the resource caching apparatus further includes:
the mapping relation table building module is configured to build a mapping relation table of the cache resources and the corresponding network request information according to the completed cache task;
the triggering module is configured to trigger to click network request information according to a browsing cache instruction submitted by the user through the application program under the condition of receiving the browsing cache instruction;
the cache resource query module is configured to determine cache resources corresponding to the click network request information by querying the mapping relation table;
and the display cache resource module is configured to extract cache resources corresponding to the click network request information from the storage space and display the cache resources to the user by using the application program.
Optionally, the resource caching apparatus further includes:
the cache resource screening module is configured to screen cache resources which are displayed by the application program in the storage space;
and the cache resource deleting module is configured to delete the cache resources which are shown by the application program.
According to a third aspect of embodiments herein, there is provided a computing device comprising:
a memory and a processor;
the memory is to store computer-executable instructions, and the processor is to execute the computer-executable instructions to:
under the condition that the user is determined to have a cache demand based on the behavior information of the user, generating a cache task according to network request information corresponding to a resource to be cached of an application program;
caching the resource to be cached according to the network request information based on the caching task;
analyzing the cached resource to be cached to obtain network request information corresponding to a lower-level cache resource of the resource to be cached, and generating a lower-level cache task corresponding to the lower-level cache resource;
detecting whether the residual storage space in the storage space for storing the cache resources is larger than a preset space threshold value or not;
and if so, caching the lower-level cache resource according to the network request information corresponding to the lower-level cache resource based on the lower-level cache task.
According to a fourth aspect of embodiments herein, there is provided a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of any one of the resource caching methods.
According to the resource caching method provided by the specification, under the condition that the user is determined to have a caching requirement based on the behavior information of the user, a caching task is generated according to network request information corresponding to a resource to be cached of an application program; caching the resource to be cached according to the network request information based on the caching task; analyzing the cached resource to be cached to obtain network request information corresponding to a lower-level cache resource of the resource to be cached, and generating a lower-level cache task corresponding to the lower-level cache resource; detecting whether the residual storage space in the storage space for storing the cache resources is larger than a preset space threshold value or not; and if so, caching the lower-level cache resource according to the network request information corresponding to the lower-level cache resource based on the lower-level cache task.
According to the embodiment of the description, the resource to be cached in the application program installed on the terminal device can be automatically cached according to the caching requirement under the condition that the user is determined to have the caching requirement according to the behavior information of the user, so that the user can still browse the content in the application program when the terminal device is in a non-network state or in a flight mode, the operation process that the user actively caches the resource to be cached is saved, and the experience effect of the user is effectively improved.
Drawings
Fig. 1 is a flowchart of a resource caching method according to an embodiment of the present specification;
fig. 2 is a process flow diagram of a resource caching method applied in a process of taking an airplane by a user according to an embodiment of the present specification;
fig. 3 is a schematic structural diagram of a resource caching apparatus according to an embodiment of the present disclosure;
fig. 4 is a block diagram of a computing device according to an embodiment of the present disclosure.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present description. This description may be embodied in many different forms and should not be construed as limited to the embodiments set forth herein, as those skilled in the art will be able to make and use the present disclosure without departing from the spirit and scope of the present disclosure.
The terminology used in the description of the one or more embodiments is for the purpose of describing the particular embodiments only and is not intended to be limiting of the description of the one or more embodiments. As used in one or more embodiments of the present specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used in one or more embodiments of the present specification refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It will be understood that, although the terms first, second, etc. may be used herein in one or more embodiments to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first can also be referred to as a second and, similarly, a second can also be referred to as a first without departing from the scope of one or more embodiments of the present description. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
In the present specification, a resource caching method is provided, and the present specification relates to a resource caching apparatus, a computing device, and a computer-readable storage medium, which are described in detail in the following embodiments one by one.
Fig. 1 shows a flowchart of a resource caching method according to an embodiment of the present disclosure, which includes steps 102 to 110.
Step 102: and generating a caching task according to network request information corresponding to the resource to be cached of the application program under the condition that the user is determined to have a caching requirement based on the behavior information of the user.
In an embodiment of the present specification, the cache resource specifically refers to a resource that needs to be cached in a terminal device of a user, so that the user can watch the cache resource when the terminal device is in a wireless or flight mode, and the cache resource is a resource in the Application program, for example, if the Application program is an APP (Application, mobile phone software) for watching news, the cache resource is a news content that can be clicked and watched by each piece of the news APP; the terminal equipment can be a mobile phone, a tablet computer, a notebook computer and the like held by a user;
on the basis, the resource caching method is described by taking the situation that the user takes an airplane and installs a news APP on a mobile phone held by the user as an example, when the user needs to take the airplane for trip, the time taken by the user to take the airplane is long, during the period, the user needs to set the mobile phone to a flight mode to avoid influencing airplane navigation, and during the period, the user cannot browse the news content in the news APP, in order to avoid the situation, the user can manually cache the content needing to be watched or the browsed content on the mobile phone in advance, so that the cached content can be watched in the airplane taking process, the airplane chatting time can be well issued, and therefore, the caching resource can be effectively issued to the user before the mobile phone is lifted.
In order to save the manual caching operation of a user and improve the experience effect of the user, the resource caching method provided by the specification can automatically cache the resource to be cached in the application program installed in the terminal device according to the caching requirement when the user is determined to have the caching requirement according to the behavior information of the user, so that the user can still browse the content in the application program when the terminal device is in a non-network state or in a flight mode, the operation process of actively caching the resource to be cached by the user is saved, and the experience effect of the user is effectively improved; and in addition, under the condition that the terminal equipment of the user releases the flight mode or is connected with the network, the resources to be cached after the caching is finished can be automatically deleted, the storage space of the terminal equipment is released, and the abnormal operation of the terminal equipment is avoided.
Specifically, the network request information may be a Uniform Resource Locator (URL) corresponding to the resource to be cached, and in a process of performing subsequent caching on the resource to be cached, a resource position needs to be determined according to the URL of the resource to be cached, and then the resource to be cached is cached, where the caching task specifically refers to a task transmitted to a terminal device held by a user, and the terminal device may determine, according to the caching task, that the resource to be cached corresponding to the network request information needs to be cached when receiving the caching task.
In one or more embodiments of this embodiment, a manner of determining that the user has a cache demand through the behavior information provides two optional manners:
1) determining the travel information of the user according to the behavior information; obtaining the travel starting time of the user by analyzing the travel information; and under the condition that the time difference value between the current time and the travel starting time is smaller than a preset time threshold, determining that the user has a cache demand.
Specifically, the travel information is specific travel information of the user, and includes information such as an origin station, a destination station, travel time, and a distance from a current position of the user to the origin station; determining the travel starting time of a user by analyzing the travel information, acquiring the current time, and indicating that the user is about to start the travel under the condition that the difference value between the current time and the travel starting time is less than a preset time threshold, wherein at the moment, the user can be determined to have a cache demand; and under the condition that the difference value between the current time and the travel starting time is greater than or equal to a time threshold, indicating that the user has a period of time from the start of the travel, and not performing any processing.
For example, the trip information of the user is 2019, 9, month and 1, the user takes an airplane from city a to city B, and the departure time of the airplane is 10: 00, landing time is 13 pm on 9/1/2019: 00, where the time threshold is 1 hour, the current time is determined by detection to be 2019, 9 month, 1 morning, 9: 21, if the time difference between the current time and the travel starting time is less than the preset time threshold value by 1 hour, it can be determined that the user has a cache demand, and resources in the APP can begin to be cached to the mobile phone of the user.
2) Determining the travel information and the position information of the user according to the behavior information; obtaining a travel starting time and a travel path of the user by analyzing the travel information, and obtaining a geographical position of the user by analyzing the position information; determining that the user has a cache demand if the geographic location is an originating location of the travel path and a current time is not up to the travel start time.
Specifically, in the process of determining the cache demand according to the behavior information, the geographic location of the user may be determined by analyzing the location information, and the travel start time and the travel route of the user may be determined according to the travel information, where the travel route specifically indicates a start station, an end station, and a point passing through the middle of the user's travel process;
based on this, the starting position of the user's journey is determined according to the journey path, and in the case that the geographic position is consistent with the starting position and the current time does not exceed the journey starting time, it is indicated that the user may be in a waiting state, namely, the journey will be started, at this time, it can be determined that the user has a cache demand.
Still with the user's trip information being 2019, 9, month 1, take the airplane from city a to city B, the airplane takeoff time is 10: 00, landing time is 13 pm on 9/1/2019: 00 for example, the above is described, the geographic location of the user is determined to be city a by analyzing the location information of the user, the geographic location of the user is determined to be the starting location of the travel route by detecting and the current time is 2019, 9/1/am 9: and 21, determining that the user has a cache demand at the time for the journey starting time, and starting caching resources in the APP to the mobile phone of the user.
In addition, since real-name authentication is required when the airplane ticket or the train ticket is purchased, and before the airplane takes off or the train is dispatched, the reminding information is sent to the mobile phone number added when the ticket is purchased, the cache requirement of the user can be determined by detecting the short message information in the mobile phone of the user, and the cache requirement of the user can be determined under the condition that the reminding short message of the airplane taking off or the train dispatching exists in the mobile phone of the user; in the process of detecting the short message, the keyword in the short message can be read, for example: and determining the travel of the user according to the information of the departure time, the departure place and the like, and determining the cache requirement of the user according to the time.
Or the method can also determine according to the information of the network base station connected with the mobile phone of the user, and under the condition that the network base station connected with the user belongs to the airport range, the user can also determine that the user possibly needs to take an airplane, so as to determine that the user has a cache demand.
In the embodiment of the specification, the user can be determined to have the cache requirement through the behavior information of the user, so that the behavior information of the user can be automatically detected, the resource to be cached in the application program can be automatically cached, the process that the user manually opens the cache resource is saved, and the experience effect of the user is effectively improved.
On the basis of determining that the user has a cache demand according to the behavior information, further, in one or more embodiments of this embodiment, in order to avoid caching a resource to be cached that is not interested by the user, the resource to be cached may be determined according to attribute information of the user, and a specific embodiment is as follows:
acquiring attribute information of the user;
selecting a cache resource matched with the attribute information from the application program as the resource to be cached;
and generating the caching task according to the network request information corresponding to the resource to be cached.
Specifically, the attribute information of the user is obtained, where the attribute information may be type information of resources in an application program frequently browsed by the user in the process of using the application program, and a cache resource matched with the attribute information is selected as the resource to be cached in the application program according to the attribute information, where the resource to be cached matched with the attribute information specifically refers to selecting a cache resource, which is interested by the user, in the application program as the resource to be cached, and then the cache task is generated according to network request information corresponding to the resource to be cached.
For example, if the attribute information of the user is obtained by frequently using a news APP on a mobile phone to watch automobile news, the automobile news in the home page of the news APP is used as a resource to be cached, a caching task is generated according to network request information corresponding to the automobile news, and the automobile news in the news APP can be preferentially cached in the process of subsequently caching the resource to be cached.
In the embodiment of the present specification, before caching the resource to be cached, the resource to be cached is determined according to the attribute information of the user, so that the waste of a storage space caused by caching the resource which is not interested by the user in the subsequent resource caching process is avoided, and the storage space is effectively saved by caching the cache resource matched with the attribute information of the user.
Step 104: and caching the resources to be cached according to the network request information based on the caching task.
On the basis of the above-mentioned generation of the cache task according to the network request information corresponding to the resource to be cached, further, the resource to be cached is cached according to the network request information based on the cache task, and the resource to be cached is stored in a cache space.
In specific implementation, before caching the resource to be cached, the network request information corresponding to the resource to be cached needs to be determined, and the network request information also occupies a certain storage space, and in order to save the storage space, the network request information may be converted, which has the following specific implementation manner:
converting the network request information corresponding to the resource to be cached to obtain a cache identifier corresponding to the resource to be cached, and adding the cache identifier to a cache queue;
and under the condition that the cache identification is detected to exist in the cache queue, determining the network request information according to the cache identification, and executing the step of caching the resource to be cached according to the network request information based on the cache task.
Specifically, the network request information corresponding to the resource to be cached is converted to obtain a cache identifier corresponding to the resource to be cached, and the cache identifier is added to a cache queue, where the cache queue specifically refers to a queue storing the cache identifier corresponding to the resource to be cached, and the cache identifier corresponds to the unique network request information;
on the one hand, when the cache identifier is detected to exist in the cache queue, on the other hand, the network request information is determined according to the cache identifier, and then the resource to be cached is cached according to the network request information based on the cache task, if the resource to be cached exists, the cache identifier is detected to exist.
On the other hand, under the condition that the cache identifier is not detected to exist in the cache queue, no processing is required if the resource needing caching does not exist.
In the process of converting the network request information into the cache identifier, the conversion may be performed by an MD5(Message digest algorithm MD 5), so that the storage space occupied by the converted cache identifier is smaller than that occupied by the network request information.
In addition, the cache queues may include an extent cache queue and a depth cache queue, different cache queues have different ways of adding the cache identifier to the cache queue, in the extent cache queue, in the process of adding the cache identifier, the cache identifier may be added to the tail of the extent cache queue, and in the process of caching according to the cache identifier, subsequent caching may be performed by identifying the cache identifier at the tail of the extent cache queue; in the deep cache queue, in the process of adding the cache identifier, the cache identifier may be added to the head of the deep cache queue, and in the process of caching according to the cache identifier, subsequent caching may be performed by identifying the cache identifier of the head of the deep cache queue.
In the embodiment of the present specification, the network request information is converted into the cache identifier and stored in the cache queue, so that the storage space occupied by the network request information can be saved, and more resources to be cached can be stored.
Step 106: and analyzing the cached resources to be cached, obtaining network request information corresponding to lower-level cache resources of the resources to be cached, and generating lower-level cache tasks corresponding to the lower-level cache resources.
In practical application, after the resources to be cached are cached, the cached resources are the home pages in the application program, and can be understood as various news titles contained in the home interface in the application program, for example, in a news APP, the home interface of the APP is cached, the cached resources are the titles of various kinds of news of the home interface in the news APP, and the news can be watched by clicking the news titles;
on the basis, the cached resource to be cached needs to be analyzed, and network request information corresponding to the subordinate cache resource of the resource to be cached is obtained, namely, a news title of a news APP first interface is analyzed, and network request information corresponding to news content watched after the news title is clicked is obtained; and generating a lower-level cache task corresponding to the lower-level cache resource according to the network request information.
For example, the resource to be cached is a news APP initial interface, after the caching of the news APP initial interface is completed, it is determined that 3 news titles exist on the news APP initial interface, the 3 news titles are analyzed, a URL corresponding to news content corresponding to each news title is obtained, and the caching task corresponding to the 3 news content can be generated according to the URL.
In specific implementation, the resource to be cached is analyzed to obtain a next-level cache resource, and then the next-level cache resource is analyzed to obtain a next-level cache resource, which may be referred to as a next-level cache resource of the resource to be cached.
In one or more embodiments of this embodiment, when a resource to be cached in the application program includes a third-level cache resource, a process of caching the cache resource in the application program is as follows:
taking the cached resource to be cached as a first-level cache resource and analyzing the first-level cache resource to obtain second-level network request information corresponding to a second-level cache resource contained in the first-level cache resource;
generating a second-level cache task corresponding to the second-level cache resource according to the second-level network request information;
correspondingly, the caching the subordinate cache resource according to the network request information corresponding to the subordinate cache resource based on the subordinate cache task includes:
and caching the second-level cache resources according to the second-level network request information based on the second-level cache task.
Further, the cached second-level cache resources are analyzed, and third-level network request information corresponding to third-level cache resources contained in the second-level cache resources is obtained;
generating a third-level cache task corresponding to the third-level cache resource according to the third-level network request information;
detecting whether the residual storage space in the storage space after the second-level cache resources are stored is larger than the preset space threshold value;
if so, caching the third-level cache resource according to the third-level network request information based on the third-level cache task.
In practical application, the resource to be cached is used as a first-level cache resource to be analyzed, second-level network request information corresponding to a second-level cache resource contained in the first-level cache resource is obtained, a second-level cache task corresponding to the second-level cache resource is generated according to the second-level network request information, and the second-level cache resource is cached according to the second-level network request information based on the second-level cache task;
further, third-level network request information corresponding to a third-level cache resource contained in the second-level cache resource is obtained by analyzing the cached second-level cache resource, a third-level cache task corresponding to the third-level cache resource is generated according to the third-level network request information, meanwhile, whether the residual storage space in the storage space in which the second-level cache resource is stored is larger than a preset space threshold value or not is detected, if so, the storage space can continue to store the cache resource, and the third-level cache resource can be cached according to the third-level network request information based on the third-level cache task.
In the news APP, for example, the content of news 1 can be viewed by clicking on the title of news 1 in the head interface of the news APP, there is also news 1-1 under the content of news 1, and the content of news 1-1 can be viewed by clicking on news 1-1, and based on this, analyzing the head interface of the cached APP to obtain a URL1 corresponding to the news 1, generating a caching task of the news 1 according to the URL1, caching the news 1 according to the URL1 according to the caching task, then analyzing the cached news 1 to obtain the URL2 corresponding to the news 1-1, then generating the caching task of the news 1-1 according to the URL2, and simultaneously detecting whether the mobile phone storage space of the user is larger than 5 gigabytes, if so, indicating that the news 1-1 resources can be cached, and caching the news 1-1 according to the URL2 according to the caching task.
In the embodiment of the present specification, the cache resources in the application program are cached in a deep cache manner, so that a user can continue to watch the second-level cache resources included in the first-level cache resources and continue to watch the third-level resources included in the second-level cache resources after watching the first-level cache resources, the experience effect of the user is effectively improved, and the manner of caching the resources is closer to the habit of the user watching the resources in the application program.
In one or more embodiments of this embodiment, in the process of caching the cache resource, if a cache depth threshold exists, the process of caching the cache resource in the application program is as follows:
analyzing the cached resources to be cached to obtain preferred network request information corresponding to preferred cache resources matched with the attribute information in the resources to be cached;
generating a preferred caching task corresponding to the preferred caching resource according to the preferred network request information;
correspondingly, the caching the subordinate cache resource according to the network request information corresponding to the subordinate cache resource based on the subordinate cache task includes:
and caching the preferred caching resource according to the preferred network request information based on the preferred caching task.
Further, the preferred cache resources after caching are analyzed to obtain next-level network request information corresponding to next-level cache resources contained in the preferred cache resources;
judging whether the next-level network request information reaches a preset cache depth threshold value;
if yes, selecting suboptimal network request information corresponding to suboptimal cache resources matched with the attribute information from the cached resources to be cached;
generating a suboptimal cache task corresponding to the suboptimal cache resource according to the suboptimal network request information;
correspondingly, caching the subordinate cache resource according to the network request information corresponding to the subordinate cache resource based on the subordinate cache task, including:
and caching the suboptimal cache resources according to the suboptimal network request information based on the suboptimal cache task.
In practical application, analyzing the cached resource to be cached to obtain preferred network request information corresponding to a preferred cache resource matched with the attribute information in the resource to be cached, generating a preferred cache task corresponding to the preferred cache resource according to the preferred network request information, and caching the preferred cache resource according to the preferred network request information based on the preferred cache task;
further, in some application programs, it may exist that a lower level cache resource included in the resource to be cached may be clicked continuously, for example, one piece of news in a news APP is clicked, the news also includes a second level news, the second level news is clicked, the third level news is included, and so on, new news can be obtained by clicking downwards all the time;
based on this, in order to avoid the situation of excessive deep cache, after the preferred cache resource is analyzed to obtain the next-level network request information corresponding to the next-level cache resource, the next-level network request information needs to be deeply judged, namely, judging whether the next level network request information reaches a preset cache depth threshold value, wherein the preset cache depth threshold value specifically refers to that a cache level can be set in the process of caching the resource to be cached, and when the cache level reaches the preset threshold value, stopping caching, changing to caching the caching resources longitudinally, selecting suboptimal network request information corresponding to the suboptimal caching resources matched with the attribute information, and generating a suboptimal cache task corresponding to the suboptimal cache resource, and caching the suboptimal cache resource according to the suboptimal network request information based on the suboptimal cache task.
For example, news 1 and news 2 are included in the news APP header interface, and news 1 and news 2 are already cached on the user's cell phone, analyzing the news 1 to obtain URL1 corresponding to the news 1-1, generating a caching task 1, caching the news 1-1 according to the URL1 based on the caching task 1, analyzing the news 1-1 to obtain URL2 corresponding to the news 1-2, and generates cache task 2, while determining whether URL2 reaches a preset cache depth threshold, and the preset cache depth threshold is set to level 2, it can be determined that the URL2 corresponding to news 1-2 reaches the preset cache depth threshold at this time, then the vertical caching mode is selected, news 2 is selected to be cached, the network request information URL3 corresponding to the news 2 is obtained, and generates a caching task 3, and caches the news 2 by the URL3 based on the caching task 3.
In the embodiment of the present specification, by setting the depth cache threshold in the process of caching the cache resources in the application program, it is achieved that the cache resources can be cached in a longitudinal manner, so that a plurality of cache resources included in the resources to be cached in the application program can be cached, and a user can browse more resources in the application program conveniently.
Step 108: detecting whether the residual storage space in the storage space for storing the cache resources is larger than a preset space threshold value.
In practical application, in the process of caching the cache resource in the application program, considering the operation condition of the terminal device bearing the application program, in order to not affect the normal operation of the terminal device, an operation space needs to be reserved for the terminal device, at this time, a preset space threshold value is needed, and whether the remaining storage space in the storage space storing the cache resource is greater than the preset space threshold value is detected, if so, the following step 110 is executed; if not, the caching of the resources is stopped.
Step 110: caching the lower-level cache resources according to the network request information corresponding to the lower-level cache resources based on the lower-level cache tasks.
Specifically, in a case that a detection result of detecting whether a remaining storage space in the storage space storing the cache resource is greater than a preset space threshold is yes, it is indicated that the storage space may further cache the cache resource, and at this time, the lower level cache resource may be cached according to the network request information corresponding to the lower level cache resource based on the caching task.
In the specific implementation, in the process of caching the cache resource, before caching the resource based on the cache task each time, the remaining storage space of the storage space needs to be detected, so as to avoid influencing the operation of the terminal device.
On the basis of the foregoing completing the caching of the lower-level cache resource, further, in one or more embodiments of this embodiment, in order to facilitate the user to browse the cache resource that has been completed, a mapping relationship table between the cache resource and the corresponding network request information may be set, and the cache resource that the user needs to browse is determined through the mapping relationship table, which is specifically implemented as follows:
constructing a mapping relation table of cache resources and corresponding network request information according to the completed cache task;
under the condition that a browsing cache instruction submitted by the user through the application program is received, triggering and clicking network request information according to the browsing cache instruction;
determining cache resources corresponding to the click network request information by inquiring the mapping relation table;
and extracting cache resources corresponding to the click network request information from the storage space and displaying the cache resources to the user by using the application program.
Specifically, a mapping relation table of cache resources and network request information corresponding to the cache resources is established according to a completed cache task, and when a browse cache instruction submitted by a user through the application program is received, it is indicated that the user needs to browse the cache resources in the application program, at this time, network request information clicking can be triggered according to the browse cache instruction, that is, browsing contents clicked by the user are determined according to the click instruction of the user in the application program, and network request information clicking corresponding to the resources is determined according to the browsing contents;
based on this, the cache resource corresponding to the click network request information is determined by querying the mapping relation table, and then the cache resource corresponding to the click network request information is extracted from the storage space and displayed to the user by using the application program.
In this embodiment, by constructing the mapping relationship table between the cache resource and the corresponding network request information, it is achieved that, in the process of browsing the cache resource by the user, the cache resource that the user needs to browse can be quickly determined, and then the cache resource corresponding to the network request information is extracted and clicked according to the mapping relationship table, and is displayed to the user by using the application program, so that the user can experience the effect as if the terminal device has a network browsing application program.
Furthermore, after the cache resource is displayed to the user, the cache resource that the user has browsed may be deleted, and the storage space is released for the terminal device, which is specifically implemented as follows:
screening out cache resources which are displayed by the application program from the storage space;
and deleting the cache resources which are exposed and completed by the application program.
In practical application, in order not to affect the operation of the terminal device, the cache resources which are already displayed by the application program can be screened out from the storage space, and the cache resources which are already displayed by the application program are deleted, so that the storage space of the terminal device is released, and the process of manually deleting by a user is saved.
On the basis of the foregoing completion of caching the lower level cache resource, further, in one or more embodiments of this embodiment, the cache resource that is automatically cached may also be deleted when the end of the user trip is detected, and the specific implementation manner is as follows:
determining a trip end time of the user by analyzing the trip information;
and deleting the cache resources in the storage space under the condition that the current time exceeds the travel end time and the geographic position is the end position of the travel path.
In practical application, the travel information of the user is analyzed to determine the travel end time of the user, the user and the destination can be determined when the current time exceeds the travel end time, meanwhile, the end position of the travel path is further determined according to the geographical position of the user, the travel end of the user can be more accurately determined, and at the moment, the cache resource in the storage space can be deleted.
For example, during the process of taking an airplane, the user automatically caches 1 gigabyte of news resources for news APP, and the time for the user to get off the airplane is 2019, 9, 1, 13 pm: 00, the destination is city B, and by acquiring the current time and the current location, it is determined that the current time is 13 pm on 9/1/2019: 30, if the geographic position is city B, determining that the user has finished the journey, deleting 1 gigabyte of news resources in the news APP, and releasing the storage space of the mobile phone held by the user.
In the resource caching method provided by the specification, when it is determined that the user has a caching requirement according to the behavior information of the user, the resource to be cached in the application installed in the terminal device can be automatically cached according to the caching requirement, so that the user can still browse the content in the application when the terminal device is in a non-network state or in a flight mode, the operation process of actively caching the resource to be cached by the user is saved, the experience effect of the user is effectively improved, and then, when the user is detected to finish the journey, the cached resource can be automatically deleted, the storage space is released, and the normal operation of the terminal device is prevented from being influenced.
The resource caching method provided in the present specification is further described below with reference to fig. 2, by taking the application of the resource caching method in an airplane riding mode of a user as an example. Fig. 2 shows a processing flow chart of a resource caching method applied in a process of taking an airplane by a user according to an embodiment of the present specification, and specific steps include step 202 to step 222.
Step 202: and determining the travel starting time of the user according to the travel information of the user.
In practical application, a user purchases an airplane ticket flying from city C to city D, and the departure time of the airplane is 2019, 9, 5, 9 am: 00, landing time is 14 pm, 9/5/2019: 00;
based on this, it was determined that the user's travel start time was 2019, 9, 5, am 9 by detecting the purchase record of the user purchasing an airline ticket: 00.
step 204: and under the condition that the difference value between the current time and the travel starting time is less than 1 hour, determining that the user has a cache demand.
Step 206: and generating a first cache task according to the network request information corresponding to the first interface of the news APP.
Specifically, when the difference between the current time and the travel starting time is less than 1 hour, it indicates that the user is about to board the airplane immediately, the mobile phone needs to be set to the flight mode, and at this time, the news in the news APP needs to be cached, so that the user can still browse the news on the airplane;
based on the method, a first cache task is generated according to the network request information corresponding to the first interface of the news APP.
Step 208: and caching the first interface of the news APP according to the network request information based on the first caching task.
Step 210: and analyzing the first interface to obtain the network request information A corresponding to the news resource A and the network request information B corresponding to the news resource B.
Specifically, a first interface of the news APP needs to be cached in a mobile phone of a user, and network request information a corresponding to the news resource a and network request information B corresponding to the news resource B included in the first interface are obtained by analyzing the first interface.
Step 212: and selecting the news resource A matched with the attribute information of the user, and generating a second-level cache task according to the network request information A.
Specifically, in order to enable the user to browse interested news resources, a news resource a matching with the attribute information of the user needs to be selected, and a second-level cache task is generated according to the network request information a.
Step 214: detecting whether the residual storage space of the mobile phone is larger than a preset space threshold value or not; if yes, go to step 218; if not, go to step 216.
Step 216: the caching of news asset a is stopped.
Step 218: and caching the cache resource A according to the network request information A based on the second-level cache task.
Step 220: under the condition that a browsing instruction submitted by a user through a news APP is received, network request information corresponding to the browsing instruction is determined according to a mapping relation table of pre-established news resources and network request information, then the news resources corresponding to the network request information are extracted through the mapping relation table, and the news resources are displayed to the user through the news APP.
Specifically, under the condition that a browsing instruction submitted by a user through a news APP is received, the fact that the user watches news content in the news APP is shown, the network request information corresponding to the browsing instruction submitted by the user is determined according to a mapping relation table of pre-established news resources and network request information, the news resources corresponding to the network request information are determined through inquiring the mapping relation table, and the news resources cached in advance in a mobile phone are extracted and displayed to the user through the news APP.
Step 222: and deleting the news resources in the news APP under the condition that the end of the user journey is detected.
Specifically, by detecting that the current time is 2019, 9, 5 pm 15: 00, if it can be determined that the user has gone off the airplane at this time, the cached news resources in the news APP can be deleted, and the storage space of the mobile phone is released.
In the resource caching method provided by the specification, it is determined according to the travel information of the user that the user has a caching requirement, the news resource in the news APP can be automatically cached according to the caching requirement, so that the user can still browse the news content in the news APP in the mobile phone when the mobile phone is in a flight mode, the operation process of actively caching the news resource by the user is saved, the experience effect of the user is effectively improved, and then the news resource which is cached and completed can be automatically deleted under the condition that the travel of the user is finished, the storage space is released, and the normal operation of the mobile phone is prevented from being influenced.
Corresponding to the above method embodiment, this specification further provides a resource caching device embodiment, and fig. 3 shows a schematic structural diagram of a resource caching device provided in an embodiment of this specification. As shown in fig. 3, the apparatus includes:
a cache task generation module 302 configured to generate a cache task according to network request information corresponding to a resource to be cached of an application program under the condition that it is determined that a cache demand exists for a user based on behavior information of the user;
a resource caching module 304 configured to cache the resource to be cached according to the network request information based on the caching task;
a resource to be cached module 306 configured to parse the cached resource to be cached, obtain network request information corresponding to a lower-level cache resource of the resource to be cached, and generate a lower-level cache task corresponding to the lower-level cache resource;
a detect storage space module 308 configured to detect whether a remaining storage space in the storage space storing the cache resource is greater than a preset space threshold;
if yes, the cache lower level cache resource module 310 is operated;
the lower level cache resource caching module 310 is configured to cache the lower level cache resource according to the network request information corresponding to the lower level cache resource based on the lower level cache task.
In an optional embodiment, the module 306 for parsing the resource to be cached includes:
the first cache resource analyzing unit is configured to take the cached resource to be cached as a first-level cache resource and analyze the cached resource to obtain second-level network request information corresponding to a second-level cache resource contained in the first-level cache resource;
a second-level cache task generating unit configured to generate a second-level cache task corresponding to the second-level cache resource according to the second-level network request information;
accordingly, the cache lower level cache resource module 310 is further configured to:
and caching the second-level cache resources according to the second-level network request information based on the second-level cache task.
In an optional embodiment, the resource caching apparatus further includes:
the second-level cache resource analyzing module is configured to analyze the cached second-level cache resources to obtain third-level network request information corresponding to third-level cache resources contained in the second-level cache resources;
a third-level cache task generation module configured to generate a third-level cache task corresponding to the third-level cache resource according to the third-level network request information;
a detection module configured to detect whether a remaining storage space in the storage space after storing the second-level cache resource is greater than the preset space threshold;
if so, operating a third-level cache resource module;
the third-level cache resource caching module is configured to cache the third-level cache resource according to the third-level network request information based on the third-level cache task.
In an optional embodiment, the resource caching apparatus further includes:
the mapping relation table building module is configured to build a mapping relation table of the cache resources and the corresponding network request information according to the completed cache task;
the triggering module is configured to trigger to click network request information according to a browsing cache instruction submitted by the user through the application program under the condition of receiving the browsing cache instruction;
the cache resource query module is configured to determine cache resources corresponding to the click network request information by querying the mapping relation table;
and the display cache resource module is configured to extract cache resources corresponding to the click network request information from the storage space and display the cache resources to the user by using the application program.
In an optional embodiment, the resource caching apparatus further includes:
the cache resource screening module is configured to screen cache resources which are displayed by the application program in the storage space;
and the cache resource deleting module is configured to delete the cache resources which are shown by the application program.
In an optional embodiment, a specific implementation manner of determining that the user has the cache requirement according to the behavior information is as follows:
determining the travel information of the user according to the behavior information;
obtaining the travel starting time of the user by analyzing the travel information;
and under the condition that the time difference value between the current time and the travel starting time is smaller than a preset time threshold, determining that the user has a cache demand.
In an optional embodiment, a specific implementation manner of determining that the user has the cache requirement according to the behavior information is as follows:
determining the travel information and the position information of the user according to the behavior information;
obtaining a travel starting time and a travel path of the user by analyzing the travel information, and obtaining a geographical position of the user by analyzing the position information;
determining that the user has a cache demand if the geographic location is an originating location of the travel path and a current time is not up to the travel start time.
In an optional embodiment, the resource caching apparatus further includes:
a travel end time determination module configured to determine a travel end time of the user by analyzing the travel information;
and the resource deleting module is configured to delete the cache resources in the storage space under the condition that the current time exceeds the travel end time and the geographic position is the end position of the travel path.
In an optional embodiment, the generating a caching task according to network request information corresponding to a resource to be cached in an application program includes:
acquiring attribute information of the user;
selecting a cache resource matched with the attribute information from the application program as the resource to be cached;
and generating the caching task according to the network request information corresponding to the resource to be cached.
In an optional embodiment, the module 306 for parsing the resource to be cached includes:
the analyzing unit is configured to analyze the to-be-cached resource after caching is completed, and obtain preferred network request information corresponding to a preferred caching resource matched with the attribute information in the to-be-cached resource;
the generating unit is configured to generate a preferred caching task corresponding to the preferred caching resource according to the preferred network request information;
accordingly, the cache lower level cache resource module 310 is further configured to:
and caching the preferred caching resource according to the preferred network request information based on the preferred caching task.
In an optional embodiment, the resource caching apparatus further includes:
the analysis module is configured to analyze the cached preferred cache resource to obtain next-level network request information corresponding to a next-level cache resource contained in the preferred cache resource;
the judging module is configured to judge whether the next-level network request information reaches a preset cache depth threshold value;
if yes, operating the selection module;
the selecting module is configured to select suboptimal network request information corresponding to the suboptimal cache resource matched with the attribute information from the cached resources to be cached;
the generating module is configured to generate a suboptimal cache task corresponding to the suboptimal cache resource according to the suboptimal network request information;
accordingly, the cache lower level cache resource module 310 is further configured to:
and caching the suboptimal cache resources according to the suboptimal network request information based on the suboptimal cache task.
In an optional embodiment, the resource caching apparatus further includes:
the adding module is configured to obtain a cache identifier corresponding to the resource to be cached by converting the network request information corresponding to the resource to be cached, and add the cache identifier to a cache queue;
and under the condition that the cache identifier exists in the cache queue, determining the network request information according to the cache identifier, and operating the cache resource to be cached module 304.
The resource caching device provided by the specification determines that the user caches the resource to be cached in the application installed in the terminal device according to the behavior information of the user, so that the user can browse the content in the application when the terminal device is in a non-network state or in a flight mode, the operation process of actively caching the resource to be cached by the user is saved, the experience effect of the user is effectively improved, the cached resource can be automatically deleted when the user is detected to finish the journey, the storage space is released, and the normal operation of the terminal device is prevented from being influenced.
The foregoing is an exemplary scheme of a resource caching apparatus in this embodiment. It should be noted that the technical solution of the resource caching apparatus and the technical solution of the resource caching method belong to the same concept, and details that are not described in detail in the technical solution of the resource caching apparatus can be referred to the description of the technical solution of the resource caching method.
FIG. 4 illustrates a block diagram of a computing device 400 provided according to an embodiment of the present description. The components of the computing device 400 include, but are not limited to, a memory 410 and a processor 420. Processor 420 is coupled to memory 410 via bus 430 and database 450 is used to store data.
Computing device 400 also includes access device 440, access device 440 enabling computing device 400 to communicate via one or more networks 460. Examples of such networks include the Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the internet. The access device 440 may include one or more of any type of network interface (e.g., a Network Interface Card (NIC)) whether wired or wireless, such as an IEEE802.11 Wireless Local Area Network (WLAN) wireless interface, a worldwide interoperability for microwave access (Wi-MAX) interface, an ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a bluetooth interface, a Near Field Communication (NFC) interface, and so forth.
In one embodiment of the present description, the above-described components of computing device 400, as well as other components not shown in FIG. 4, may also be connected to each other, such as by a bus. It should be understood that the block diagram of the computing device architecture shown in FIG. 4 is for purposes of example only and is not limiting as to the scope of the present description. Those skilled in the art may add or replace other components as desired.
Computing device 400 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., tablet, personal digital assistant, laptop, notebook, netbook, etc.), mobile phone (e.g., smartphone), wearable computing device (e.g., smartwatch, smartglasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or PC. Computing device 400 may also be a mobile or stationary server.
Wherein processor 420 is configured to execute the following computer-executable instructions:
under the condition that the user is determined to have a cache demand based on the behavior information of the user, generating a cache task according to network request information corresponding to a resource to be cached of an application program;
caching the resource to be cached according to the network request information based on the caching task;
analyzing the cached resource to be cached to obtain network request information corresponding to a lower-level cache resource of the resource to be cached, and generating a lower-level cache task corresponding to the lower-level cache resource;
detecting whether the residual storage space in the storage space for storing the cache resources is larger than a preset space threshold value or not;
and if so, caching the lower-level cache resource according to the network request information corresponding to the lower-level cache resource based on the lower-level cache task.
The above is an illustrative scheme of a computing device of the present embodiment. It should be noted that the technical solution of the computing device and the technical solution of the resource caching method belong to the same concept, and details that are not described in detail in the technical solution of the computing device can be referred to the description of the technical solution of the resource caching method.
An embodiment of the present specification also provides a computer readable storage medium storing computer instructions that, when executed by a processor, are operable to:
under the condition that the user is determined to have a cache demand based on the behavior information of the user, generating a cache task according to network request information corresponding to a resource to be cached of an application program;
caching the resource to be cached according to the network request information based on the caching task;
analyzing the cached resource to be cached to obtain network request information corresponding to a lower-level cache resource of the resource to be cached, and generating a lower-level cache task corresponding to the lower-level cache resource;
detecting whether the residual storage space in the storage space for storing the cache resources is larger than a preset space threshold value or not;
and if so, caching the lower-level cache resource according to the network request information corresponding to the lower-level cache resource based on the lower-level cache task.
The above is an illustrative scheme of a computer-readable storage medium of the present embodiment. It should be noted that the technical solution of the storage medium and the technical solution of the resource caching method belong to the same concept, and details that are not described in detail in the technical solution of the storage medium can be referred to the description of the technical solution of the resource caching method.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The computer instructions comprise computer program code which may be in the form of source code, object code, an executable file or some intermediate form, or the like. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
It should be noted that, for the sake of simplicity, the foregoing method embodiments are described as a series of acts or combinations, but those skilled in the art should understand that the present disclosure is not limited by the described order of acts, as some steps may be performed in other orders or simultaneously according to the present disclosure. Further, those skilled in the art should also appreciate that the embodiments described in this specification are preferred embodiments and that acts and modules referred to are not necessarily required for this description.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
The preferred embodiments of the present specification disclosed above are intended only to aid in the description of the specification. Alternative embodiments are not exhaustive and do not limit the invention to the precise embodiments described. Obviously, many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the specification and its practical application, to thereby enable others skilled in the art to best understand the specification and its practical application. The specification is limited only by the claims and their full scope and equivalents.

Claims (17)

1. A method of resource caching, comprising:
under the condition that the user is determined to have a cache demand based on the behavior information of the user, generating a cache task according to network request information corresponding to a resource to be cached of an application program;
caching the resource to be cached according to the network request information based on the caching task;
analyzing the cached resource to be cached to obtain network request information corresponding to a lower-level cache resource of the resource to be cached, and generating a lower-level cache task corresponding to the lower-level cache resource;
detecting whether the residual storage space in the storage space for storing the cache resources is larger than a preset space threshold value or not;
and if so, caching the lower-level cache resource according to the network request information corresponding to the lower-level cache resource based on the lower-level cache task.
2. The resource caching method according to claim 1, wherein the analyzing the cached resource to be cached to obtain network request information corresponding to a lower level cache resource of the resource to be cached and generating a lower level cache task corresponding to the lower level cache resource includes:
taking the cached resource to be cached as a first-level cache resource and analyzing the first-level cache resource to obtain second-level network request information corresponding to a second-level cache resource contained in the first-level cache resource;
generating a second-level cache task corresponding to the second-level cache resource according to the second-level network request information;
correspondingly, the caching the subordinate cache resource according to the network request information corresponding to the subordinate cache resource based on the subordinate cache task includes:
and caching the second-level cache resources according to the second-level network request information based on the second-level cache task.
3. The resource caching method according to claim 2, wherein after the step of caching the lower level cache resource according to the network request information corresponding to the lower level cache resource based on the lower level cache task is executed, the method further comprises:
analyzing the cached second-level cache resources to obtain third-level network request information corresponding to third-level cache resources contained in the second-level cache resources;
generating a third-level cache task corresponding to the third-level cache resource according to the third-level network request information;
detecting whether the residual storage space in the storage space after the second-level cache resources are stored is larger than the preset space threshold value;
if so, caching the third-level cache resource according to the third-level network request information based on the third-level cache task.
4. The resource caching method according to claim 1, wherein after the step of caching the lower level cache resource according to the network request information corresponding to the lower level cache resource based on the lower level cache task is executed, the method further comprises:
constructing a mapping relation table of cache resources and corresponding network request information according to the completed cache task;
under the condition that a browsing cache instruction submitted by the user through the application program is received, triggering and clicking network request information according to the browsing cache instruction;
determining cache resources corresponding to the click network request information by inquiring the mapping relation table;
and extracting cache resources corresponding to the click network request information from the storage space and displaying the cache resources to the user by using the application program.
5. The resource caching method according to claim 4, wherein after the step of extracting the cache resource corresponding to the click network request information from the storage space and presenting the cache resource to the user by the application program is executed, the method further comprises:
screening out cache resources which are displayed by the application program from the storage space;
and deleting the cache resources which are exposed and completed by the application program.
6. The resource caching method according to claim 1, wherein a specific implementation manner for determining that the user has a caching requirement according to the behavior information is as follows:
determining the travel information of the user according to the behavior information;
obtaining the travel starting time of the user by analyzing the travel information;
and under the condition that the time difference value between the current time and the travel starting time is smaller than a preset time threshold, determining that the user has a cache demand.
7. The resource caching method according to claim 1, wherein a specific implementation manner for determining that the user has a caching requirement according to the behavior information is as follows:
determining the travel information and the position information of the user according to the behavior information;
obtaining a travel starting time and a travel path of the user by analyzing the travel information, and obtaining a geographical position of the user by analyzing the position information;
determining that the user has a cache demand if the geographic location is an originating location of the travel path and a current time is not up to the travel start time.
8. The resource caching method according to claim 7, wherein after the step of caching the lower level cache resource according to the network request information corresponding to the lower level cache resource based on the lower level cache task is executed, the method further comprises:
determining a trip end time of the user by analyzing the trip information;
and deleting the cache resources in the storage space under the condition that the current time exceeds the travel end time and the geographic position is the end position of the travel path.
9. The resource caching method according to claim 1, wherein the generating of the caching task according to the network request information corresponding to the resource to be cached of the application program comprises:
acquiring attribute information of the user;
selecting a cache resource matched with the attribute information from the application program as the resource to be cached;
and generating the caching task according to the network request information corresponding to the resource to be cached.
10. The resource caching method according to claim 9, wherein the analyzing the cached resource to be cached to obtain network request information corresponding to a lower level cache resource of the resource to be cached and generating a lower level cache task corresponding to the lower level cache resource includes:
analyzing the cached resources to be cached to obtain preferred network request information corresponding to preferred cache resources matched with the attribute information in the resources to be cached;
generating a preferred caching task corresponding to the preferred caching resource according to the preferred network request information;
correspondingly, the caching the subordinate cache resource according to the network request information corresponding to the subordinate cache resource based on the subordinate cache task includes:
and caching the preferred caching resource according to the preferred network request information based on the preferred caching task.
11. The resource caching method according to claim 10, wherein after the step of caching the lower level cache resource according to the network request information corresponding to the lower level cache resource based on the lower level cache task is executed, the method further comprises:
analyzing the cached preferable cache resources to obtain next-level network request information corresponding to next-level cache resources contained in the preferable cache resources;
judging whether the next-level network request information reaches a preset cache depth threshold value;
if yes, selecting suboptimal network request information corresponding to suboptimal cache resources matched with the attribute information from the cached resources to be cached;
generating a suboptimal cache task corresponding to the suboptimal cache resource according to the suboptimal network request information;
correspondingly, caching the subordinate cache resource according to the network request information corresponding to the subordinate cache resource based on the subordinate cache task, including:
and caching the suboptimal cache resources according to the suboptimal network request information based on the suboptimal cache task.
12. The resource caching method according to claim 1, wherein after the step of generating the caching task according to the network request information corresponding to the resource to be cached of the application program is executed and before the step of caching the resource to be cached according to the network request information based on the caching task is executed, when it is determined that the user has the caching requirement based on the behavior information of the user, the method further comprises:
converting the network request information corresponding to the resource to be cached to obtain a cache identifier corresponding to the resource to be cached, and adding the cache identifier to a cache queue;
and under the condition that the cache identification is detected to exist in the cache queue, determining the network request information according to the cache identification, and executing the step of caching the resource to be cached according to the network request information based on the cache task.
13. A resource caching apparatus, comprising:
the cache task generation module is configured to generate a cache task according to network request information corresponding to a resource to be cached of an application program under the condition that the user is determined to have a cache requirement based on behavior information of the user;
a resource caching module configured to cache the resource to be cached according to the network request information based on the caching task;
the resource module to be cached is configured to parse the cached resource to be cached, obtain network request information corresponding to a lower-level cache resource of the resource to be cached, and generate a lower-level cache task corresponding to the lower-level cache resource;
a storage space detection module configured to detect whether a remaining storage space in a storage space storing the cache resource is greater than a preset space threshold;
if yes, operating a cache lower-level cache resource module;
the lower-level cache resource caching module is configured to cache the lower-level cache resource according to the network request information corresponding to the lower-level cache resource based on the lower-level cache task.
14. The resource caching apparatus of claim 13, further comprising:
the mapping relation table building module is configured to build a mapping relation table of the cache resources and the corresponding network request information according to the completed cache task;
the triggering module is configured to trigger to click network request information according to a browsing cache instruction submitted by the user through the application program under the condition of receiving the browsing cache instruction;
the cache resource query module is configured to determine cache resources corresponding to the click network request information by querying the mapping relation table;
and the display cache resource module is configured to extract cache resources corresponding to the click network request information from the storage space and display the cache resources to the user by using the application program.
15. The resource caching apparatus of claim 14, further comprising:
the cache resource screening module is configured to screen cache resources which are displayed by the application program in the storage space;
and the cache resource deleting module is configured to delete the cache resources which are shown by the application program.
16. A computing device, comprising:
a memory and a processor;
the memory is to store computer-executable instructions, and the processor is to execute the computer-executable instructions to:
under the condition that the user is determined to have a cache demand based on the behavior information of the user, generating a cache task according to network request information corresponding to a resource to be cached of an application program;
caching the resource to be cached according to the network request information based on the caching task;
analyzing the cached resource to be cached to obtain network request information corresponding to a lower-level cache resource of the resource to be cached, and generating a lower-level cache task corresponding to the lower-level cache resource;
detecting whether the residual storage space in the storage space for storing the cache resources is larger than a preset space threshold value or not;
and if so, caching the lower-level cache resource according to the network request information corresponding to the lower-level cache resource based on the lower-level cache task.
17. A computer readable storage medium storing computer instructions which, when executed by a processor, implement the steps of the resource caching method of any one of claims 1 to 12.
CN201911001053.4A 2019-10-21 2019-10-21 Resource caching method and device Pending CN110765383A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911001053.4A CN110765383A (en) 2019-10-21 2019-10-21 Resource caching method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911001053.4A CN110765383A (en) 2019-10-21 2019-10-21 Resource caching method and device

Publications (1)

Publication Number Publication Date
CN110765383A true CN110765383A (en) 2020-02-07

Family

ID=69331453

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911001053.4A Pending CN110765383A (en) 2019-10-21 2019-10-21 Resource caching method and device

Country Status (1)

Country Link
CN (1) CN110765383A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112866811A (en) * 2021-01-20 2021-05-28 深圳创维-Rgb电子有限公司 Smart television control method and device, smart television and readable storage medium
CN113259995A (en) * 2021-05-17 2021-08-13 北京小米移动软件有限公司 Information processing method, device and storage medium
CN113938551A (en) * 2021-10-15 2022-01-14 维沃移动通信有限公司 Caching method and device and electronic equipment
CN114564667A (en) * 2022-04-28 2022-05-31 深圳市艾德网络科技发展有限公司 Low-delay cache data processing method for analyzing large-scale data
WO2023202483A1 (en) * 2022-04-19 2023-10-26 华为技术有限公司 Application optimization method and electronic device

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103729438A (en) * 2013-12-30 2014-04-16 优视科技有限公司 Webpage preloading method and device
CN108055213A (en) * 2017-12-08 2018-05-18 盛科网络(苏州)有限公司 The management method and system of the cache resources of the network switch
CN108205540A (en) * 2016-12-16 2018-06-26 腾讯科技(深圳)有限公司 The methods, devices and systems of information browse
CN109151742A (en) * 2018-06-27 2019-01-04 维沃移动通信有限公司 A kind of information prompting method and terminal device
CN109684015A (en) * 2018-12-25 2019-04-26 北京微播视界科技有限公司 Loading method, device, electronic equipment and the storage medium of interface data
CN109990799A (en) * 2019-03-28 2019-07-09 北京小米移动软件有限公司 The tactful display methods of trip, device and storage medium
CN110225393A (en) * 2019-05-29 2019-09-10 阿里巴巴集团控股有限公司 Video cache method and device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103729438A (en) * 2013-12-30 2014-04-16 优视科技有限公司 Webpage preloading method and device
CN108205540A (en) * 2016-12-16 2018-06-26 腾讯科技(深圳)有限公司 The methods, devices and systems of information browse
CN108055213A (en) * 2017-12-08 2018-05-18 盛科网络(苏州)有限公司 The management method and system of the cache resources of the network switch
CN109151742A (en) * 2018-06-27 2019-01-04 维沃移动通信有限公司 A kind of information prompting method and terminal device
CN109684015A (en) * 2018-12-25 2019-04-26 北京微播视界科技有限公司 Loading method, device, electronic equipment and the storage medium of interface data
CN109990799A (en) * 2019-03-28 2019-07-09 北京小米移动软件有限公司 The tactful display methods of trip, device and storage medium
CN110225393A (en) * 2019-05-29 2019-09-10 阿里巴巴集团控股有限公司 Video cache method and device

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112866811A (en) * 2021-01-20 2021-05-28 深圳创维-Rgb电子有限公司 Smart television control method and device, smart television and readable storage medium
CN113259995A (en) * 2021-05-17 2021-08-13 北京小米移动软件有限公司 Information processing method, device and storage medium
CN113259995B (en) * 2021-05-17 2023-08-04 北京小米移动软件有限公司 Information processing method, device and storage medium
CN113938551A (en) * 2021-10-15 2022-01-14 维沃移动通信有限公司 Caching method and device and electronic equipment
CN113938551B (en) * 2021-10-15 2023-04-11 维沃移动通信有限公司 Caching method and device, electronic equipment and storage medium
WO2023061358A1 (en) * 2021-10-15 2023-04-20 维沃移动通信有限公司 Cache method and apparatus, and electronic device
WO2023202483A1 (en) * 2022-04-19 2023-10-26 华为技术有限公司 Application optimization method and electronic device
CN114564667A (en) * 2022-04-28 2022-05-31 深圳市艾德网络科技发展有限公司 Low-delay cache data processing method for analyzing large-scale data

Similar Documents

Publication Publication Date Title
CN110765383A (en) Resource caching method and device
CN103401763B (en) Method and device for receiving group message and method and device for processing group message
US10291767B2 (en) Information presentation method and device
US20140074527A1 (en) Schedule generation method and communication terminal for schedule generation method
CN103888837A (en) Video information pushing method and device
WO2017053298A1 (en) System and method for preprocessing user applications
CN102801817B (en) Subscriber context-based pushing method and device
CN104142964A (en) Information matching method and device
CN107885873B (en) Method and apparatus for outputting information
US9176945B1 (en) Extracting data from messages for multiple accounts
CN107767153B (en) Data processing method and device
JP5433472B2 (en) Behavior prediction apparatus, method, and program
KR20120045415A (en) Method and apparatus for providing intelligent service
CN104010035A (en) Method and system for application program distribution
CN111028834B (en) Voice message reminding method and device, server and voice message reminding equipment
CN106708820B (en) Information display method and device
CN108470057B (en) Generating and pushing method, device, terminal, server and medium of integrated information
CN110533456A (en) A kind of coupon information method for pushing, system and server
CN111191133B (en) Service search processing method, device and equipment
CN104380768B (en) Address book information service system and method and device for address book information service
CN106133780A (en) Terminal use's performance evaluation
JP2013137738A (en) Information processing method and device
CN104639593A (en) Information sharing method and system, browser and server
CN113626624B (en) Resource identification method and related device
CN105893584A (en) Method, client and system for displaying website label of favorites

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20211215

Address after: Room 602, No. 618, Wai Road, Huangpu District, Shanghai 200010

Applicant after: Ant fortune (Shanghai) Financial Information Service Co.,Ltd.

Address before: 801-11, Section B, 8th floor, 556 Xixi Road, Xihu District, Hangzhou City, Zhejiang Province, 310013

Applicant before: Alipay (Hangzhou) Information Technology Co.,Ltd.

RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200207