CN109726017B - Method and device for sharing cache between application programs - Google Patents

Method and device for sharing cache between application programs Download PDF

Info

Publication number
CN109726017B
CN109726017B CN201711038744.2A CN201711038744A CN109726017B CN 109726017 B CN109726017 B CN 109726017B CN 201711038744 A CN201711038744 A CN 201711038744A CN 109726017 B CN109726017 B CN 109726017B
Authority
CN
China
Prior art keywords
application program
cache
application
data
group
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201711038744.2A
Other languages
Chinese (zh)
Other versions
CN109726017A (en
Inventor
刘志龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201711038744.2A priority Critical patent/CN109726017B/en
Publication of CN109726017A publication Critical patent/CN109726017A/en
Application granted granted Critical
Publication of CN109726017B publication Critical patent/CN109726017B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

A method and apparatus for sharing cache between applications is disclosed. The method for sharing the cache between the application programs comprises the following steps: determining data which needs to be written into a cache by a first application program in an application program group, wherein the application program group is an established application program group sharing the cache; and selecting at least one started second application program from the application program group, and storing the data needing to be cached in the private cache of the second application program. The technical scheme can share the cache among a plurality of application programs, and avoid the cache of a single application program from growing too fast.

Description

Method and device for sharing cache between application programs
Technical Field
The present invention relates to communication technologies, and in particular, to a method and apparatus for sharing cache between application programs.
Background
The content carried by application programs (apps) on mobile terminals is increasing, resulting in a significant increase in the cache occupied by the applications. Under the condition that the storage space of the mobile terminal is smaller, a user is often caused to clean the cache.
In the related art, some cleaning software installed on a mobile terminal can identify a cache directory of each application program, and when the cache of a single application program is large, the cleaning software can easily identify and clean the application program. If cached on an external memory card, there is an instability factor because the external memory card may be removed by the user.
Therefore, how to avoid the buffer of a single application program from being excessively large and ensure the stability of the buffer is a problem to be solved.
Disclosure of Invention
The application provides a method and a device for sharing cache among application programs, which can share the cache among a plurality of application programs and avoid the cache of a single application program from growing too fast.
According to a first aspect of the present application, an embodiment of the present application provides a method for sharing a cache between application programs, including:
determining data which needs to be written into a cache by a first application program in an application program group, wherein the application program group is an established application program group sharing the cache;
and selecting at least one started second application program from the application program group, and storing the data needing to be cached in the private cache of the second application program.
According to a second aspect of the present application, an embodiment of the present application further provides a method for sharing a cache between application programs, including:
determining data which needs to be read from a cache by a first application program in an application program group, wherein the application program group is an established application program group sharing the cache;
and determining a second application program which provides a private cache for the data to be read, and reading the data to be read from the private cache of the second application program.
According to a third aspect of the present application, an embodiment of the present application further provides an apparatus for sharing a cache between application programs, including:
the data determining module is used for determining data which needs to be written into the cache by a first application program in the application program group, wherein the application program group is an established application program group sharing the cache;
and the write cache module is used for selecting at least one started second application program from the application program group and storing the data needing to be cached in the private cache of the second application program.
According to a fourth aspect of the present application, an embodiment of the present application further provides an apparatus for sharing a cache between application programs, including:
the data determining module is used for determining data which needs to be read from the cache by a first application program in the application program group, wherein the application program group is an established application program group sharing the cache;
and the read cache module is used for determining a second application program which provides private caches for the data to be read, and reading the data to be read from the private caches of the second application program.
According to a fifth aspect of the present application, an embodiment of the present application further provides an apparatus for sharing a cache between application programs, including:
The method comprises the steps of a memory, a processor and a processing program which is stored in the memory and can share a buffer between application programs running on the processor, wherein the processing program which shares the buffer between the application programs realizes the method for sharing the buffer between the application programs according to the first aspect of the application when the processing program which shares the buffer between the application programs is executed by the processor.
According to a sixth aspect of the present application, an embodiment of the present application further provides an apparatus for sharing a cache between application programs, including:
the method comprises the steps of a memory, a processor and a processing program which is stored in the memory and can share a buffer between application programs running on the processor, wherein the processing program which shares the buffer between the application programs realizes the method for sharing the buffer between the application programs according to the second aspect of the application when the processing program which shares the buffer between the application programs is executed by the processor.
According to a seventh aspect of the present application, an embodiment of the present application further provides a computer readable storage medium, where a program for sharing a cache between application programs is stored, where the program for sharing a cache between application programs implements the steps of the method for sharing a cache between application programs according to the first aspect of the present application when the program for sharing a cache between application programs is executed by a processor.
According to an eighth aspect of the present application, an embodiment of the present application further provides a computer readable storage medium, where a program for sharing a cache between application programs is stored, where the program for sharing a cache between application programs, when executed by a processor, implements the steps of the method for sharing a cache between application programs according to the second aspect of the present application.
According to the method and the device for caching the application programs, at least one embodiment shares the cache among the application programs, the situation that the cache of a single application program grows too fast is avoided, limited cache space can be fully utilized, and the utilization rate of the cache is improved.
Of course, it is not necessary for any of the products of the present application to be practiced with all of the advantages described above.
Drawings
The accompanying drawings are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate and do not limit the invention.
FIG. 1 is a flowchart of a method for sharing a cache between applications according to a first embodiment of the present invention;
FIG. 2 is a flowchart of a method for sharing a cache between applications according to a second embodiment of the present invention;
FIG. 3 is a schematic diagram illustrating an apparatus for sharing a cache between applications according to a third embodiment of the present invention;
FIG. 4 is a schematic diagram of an apparatus for sharing a cache between applications according to a fourth embodiment of the present invention;
FIG. 5 is a schematic diagram of a process for creating and managing a group of applications sharing a cache in application example 1 of the present invention;
FIG. 6 is a flowchart of a method for caching data for any one application in a shared cache application group in application example 2 of the present invention;
fig. 7 is a flowchart of a method for reading data from a cache by any application program in the application program group sharing the cache in application example 3 of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail hereinafter with reference to the accompanying drawings. It should be noted that, in the case of no conflict, the embodiments and features in the embodiments may be arbitrarily combined with each other.
The steps illustrated in the flowchart of the figures may be performed in a computer system, such as a set of computer-executable instructions. Also, while a logical order is depicted in the flowchart, in some cases, the steps depicted or described may be performed in a different order than presented herein.
Example 1
As shown in fig. 1, a method for sharing a cache between application programs includes:
s110, determining data which needs to be written into a cache by a first application program in an application program group, wherein the application program group is an established application program group sharing the cache;
and S120, selecting at least one started second application program from the application program group, and storing the data needing to be cached in the private cache of the second application program.
The method of the embodiment is applied to terminals, in particular mobile terminals (mobile phones, tablet computers and the like).
In this embodiment, the application group is a coalition of a plurality of applications, where each application takes out a part of its own private storage space to share. For example, a user may customize a set of applications (i.e., an application consortium) that configure multiple applications to make up a shared cache. For example, the user configures the applications a, B, C, D, E, F as a group of applications sharing a cache, and the applications a, B, C, D, E, F may establish a communication connection through the same software development kit (Software Development Kit, SDK). After the application program alliances are established by the application programs, all the application programs in the application program alliances can communicate with each other and share part of private caches, so that the situation that the caches of the application programs are not used enough when the loads of the single application program are too heavy is avoided, and the caches of other application programs with lighter loads are idle, and the effect of load balancing can be achieved inside the alliances.
In this embodiment, the application program alliance (application program group) has an administrator, which is responsible for unified management of the caches shared by the application programs. In one embodiment, the manager is the earliest launched application in the application group. In other embodiments, the manager may be the least loaded application of all launched applications. In other embodiments, the manager may also be an application with the lowest frequency of use among all started applications, for example, the software development kit commonly used by the application group has a monitoring channel for monitoring the starting or closing of each application, where the monitoring channel may count the frequency of use of all applications, and the system accumulates the usage count of the application once every time an application is started. A communication connection is established between the manager of the application group and other applications in a startup state. When a started application is closed, if the started application is not an administrator, the administrator can learn that the application is closed, for example, a background monitoring channel for starting or closing each application can send a notification message to the administrator to tell the administrator that an event of closing the application occurs. And after knowing that the application program with the communication connection with the manager is closed, the manager deletes the communication connection between the manager and the closed application program. The shared cache of all application programs is uniformly managed by one manager in the application program alliance, so that the allocation and release of the cache are centrally managed.
In this embodiment, when an activated application (e.g., application a) in the application group needs to write data into the cache, if the activated application (e.g., application a) is itself an administrator, the activated application is used as a first application, and at least one activated application (e.g., application C) is selected from the application group as a second application. If the launched application (e.g., application a) is not itself a manager, the launched application (e.g., application a) acts as a first application, a data cache request is sent to the manager (e.g., application B), and the manager selects at least one launched application (e.g., application C) from the set of applications as a second application. That is, the first application is an application that needs to write a cache, and the second application is an application that currently provides a cache space. The application program determined by the manager to provide the cache space may be the first application program applying for writing the cache, or the manager itself, or other started application programs. The manager uniformly distributes the shared buffer, so that the unordered competition state of each application program can be avoided when the shared buffer is used.
In one embodiment, when a first application program needs to write data into a cache, the first application program generates a cache identifier and cache content according to the data to be cached. For example, assuming that the application program a wants to cache "Zhang three cell phone number (13645678911)", the application program a generates a cache identification of "Zhang three cell phone number" as the first application program from the data to be cached, and the cache content is "13645678911".
In one embodiment, if the first application program is not the manager, when the first application program sends a data caching request to the manager, the data caching request carries a caching identifier and caching content corresponding to data to be cached. For example, application a sends a data cache request to the manager (application B) carrying a cache identification ("Zhang three cell phone number") and cache content ("13645678911").
In this embodiment, after determining the second application program that provides the shared cache, if the second application program is the manager, the manager stores the cache content in the shared cache of the manager, establishes a correspondence between the cache identifier corresponding to the data to be cached and the second application program, and stores the correspondence. If the second application program is not the manager, the manager sends a write cache request to the second application program, wherein the write cache request carries a cache identifier corresponding to data to be cached by the first application program and cache content, establishes a corresponding relation between the cache identifier corresponding to the data to be cached and the second application program, and stores the corresponding relation. After receiving the write cache request, the second application program stores the cache content in the own shared cache, establishes a corresponding relation between the cache identifier and the cache address and stores the corresponding relation. The manager provides a first level index for locating the data save location (the application providing the shared cache) when reading the data later by establishing a correspondence between the cache identity and the application providing the cache. The second application program provides a second level index for positioning a data storage position (providing a cache space of the shared cache) when reading data later by establishing a corresponding relation between the cache identification and the cache address. The flexibility of data caching can be greatly expanded through two-pole indexing of the cache address (second level) of the application program (first level) and the application program, and the data of one application program can be cached in the own cache space or the shared cache of other application programs.
In the technical solution of this embodiment, for an application program group that shares a cache, private caches of each application program become the shared cache in the application program group, and when any application program in the application program group wants to cache data, by equally dividing a storage task among a plurality of private caches, it is possible to avoid that the cache burden of a single application program is excessively heavy.
Example two
As shown in fig. 2, a method for sharing a cache between application programs includes:
s210, determining data which needs to be read from a cache by a first application program in an application program group, wherein the application program group is an established application program group sharing the cache;
s220, determining a second application program which provides a private cache for the data to be read, and reading the data to be read from the private cache of the second application program.
The method of the embodiment is applied to terminals, in particular mobile terminals (mobile phones, tablet computers and the like).
In this embodiment, the application group is a coalition of a plurality of applications, where each application takes out a part of its own private storage space to share. For example, a user may customize a set of applications (i.e., an application consortium) that configure multiple applications to make up a shared cache. For example, the user configures the applications a, B, C, D, E, F as a group of applications sharing a cache, and the applications a, B, C, D, E, F may establish a communication connection through the same software development kit (Software Development Kit, SDK). After the application program alliances are established by the application programs, all the application programs in the application program alliances can communicate with each other and share part of private caches, so that the situation that the caches of the application programs are not used enough when the loads of the single application program are too heavy is avoided, and the caches of other application programs with lighter loads are idle, and the effect of load balancing can be achieved inside the alliances.
In this embodiment, the application program alliance (application program group) has an administrator, which is responsible for unified management of the caches shared by the application programs. In one embodiment, the manager is the earliest launched application in the application group. In other embodiments, the manager may be the least loaded application of all launched applications. In other embodiments, the manager may also be an application with the lowest frequency of use among all started applications, for example, the software development kit commonly used by the application group has a monitoring channel for monitoring the starting or closing of each application, where the monitoring channel may count the frequency of use of all applications, and the system accumulates the usage count of the application once every time an application is started. A communication connection is established between the manager of the application group and other applications in a startup state. When a started application is closed, if the started application is not an administrator, the administrator can learn that the application is closed, for example, a background monitoring channel for starting or closing each application can send a notification message to the administrator to tell the administrator that an event of closing the application occurs. And after knowing that the application program with the communication connection with the manager is closed, the manager deletes the communication connection between the manager and the closed application program. The shared cache of all application programs is uniformly managed by one manager in the application program alliance, so that the allocation and release of the cache are centrally managed.
In this embodiment, when an activated first application (such as application a) in the application group needs to read data from the cache, if the activated first application is an administrator, the administrator queries the corresponding relationship between the cache identifier and the application providing the private cache according to the cache identifier of the data to be read, and determines, according to the query result, a second application (such as application C) providing the private cache for the data to be read. For example, assuming that the application program a wants to read "Zhang three cell phone number", the application program a determines as the first application program that the cache identification of the data to be read is "Zhang three cell phone number". Assuming that application a is an administrator, the application queries a correspondence between locally stored cache identities (e.g., "Zhang three cell phone number") and second applications to determine a second application (e.g., application C) that provides a shared cache. In other embodiments, when an activated first application (such as application a) in the application group needs to read data from the cache, if the activated first application (such as application a) is not an administrator, the first application (such as application a) sends a data reading request to the administrator (such as application B) of the application group, where the data reading request carries a cache identifier corresponding to the data to be read. And the manager (such as the application program B) inquires the corresponding relation between the cache identification and the application program providing the private cache according to the cache identification of the data to be read, and determines a second application program (such as the application program C) providing the private cache for the data to be read according to the inquired result. For example, assuming that the application program a wants to read "Zhang three cell phone number", the application program a determines as the first application program that the cache identification of the data to be read is "Zhang three cell phone number". Assuming that the application a is not a manager, but the manager is the application B, the first application (for example, the application a) sends a data reading request to the manager (for example, the application B), where the data reading request carries a cache identifier (for example, a "Zhang three mobile phone number") corresponding to the data to be read. The manager queries the correspondence between the locally stored cache identity (e.g., "Zhang three cell phone number") and the second application program to determine the second application program (e.g., application program C) that provides the shared cache. The manager obtains the first-level index (application program) of the data to be read by inquiring the corresponding relation between the cache identification and the application program providing the cache.
In this embodiment, after the manager determines the second application program corresponding to the cache where the data to be read is located, the manager sends a read cache request to the second application program, where the read cache request carries a cache identifier corresponding to the data to be read, and the second application program reads the data from the private cache of the second application program according to the cache identifier of the data to be read, and returns the data to the manager of the application program group. The second application program stores the corresponding relation between the cache identification and the cache address, and the corresponding relation is a second-level index when the data is read. In one embodiment, if the first application is not a manager, the manager forwards the cached data returned by the second application to the first application after obtaining the cached data. The flexibility of data caching can be greatly expanded through two-pole indexing of the cache addresses (the first level) of the application program and the application program, and one application program can read cache data from the own cache space and can read the data cached there from the shared caches of other application programs through assistance of an administrator.
In one embodiment, after determining a second application program that provides a private cache for data to be read, if the second application program is in a closed state, the manager starts the second application program, reads the data from its own shared cache after the second application program is started, returns the data to the manager, and then closes the second application program.
In the technical solution of this embodiment, for an application program group that shares a cache, private caches of respective application programs become the shared cache in the application program group, and when any one application program in the application program group wants to read cache data, the application program that provides the private cache is determined by the cache identifier of the data, and data is read from the cache of the application program that provides the private cache. By equally dividing the storage tasks among the plurality of private caches, overburdening of the caches of a single application can be avoided.
Example III
As shown in fig. 3, an apparatus for sharing a cache between application programs includes:
the data determining module 301 is configured to determine data that needs to be written into a cache by a first application in an application group, where the application group is an application group that is established and shares the cache;
And the write caching module 302 is configured to select at least one second application program that has been started from the application program group, and store the data that needs to be cached in the private cache of the second application program.
In one embodiment, the application group includes an administrator, which is one application in the application group that is in a startup state.
In one embodiment, the manager is the earliest launched application in the application group.
In one embodiment, the administrator establishes a communication connection with other applications in a startup state.
In one embodiment, the apparatus further comprises:
and the configuration module 303 is configured to delete the communication connection between the manager and the closed application after the application having the communication connection with the manager is closed.
In one embodiment, the write cache module is configured to select at least one second application that has been started from the application group if the first application is an administrator of the application group, by: the first application program generates a cache identification and cache content according to data to be cached; the first application program selects at least one application program which is started from the application program group as a second application program for providing private cache.
In one embodiment, the write cache module is configured to select at least one second application that has been started from the application group if the first application is not an administrator of the application group, by: the first application program generates a cache identification and cache content according to data to be cached; and the first application program sends a data caching request to an administrator of the application program group, and the administrator selects at least one started application program from the application program group as a second application program for providing private caching, wherein the data caching request carries a caching identifier and caching content corresponding to data to be cached.
In one embodiment, the write caching module is configured to store the data to be cached in the private cache of the second application program in the following manner: the manager of the application program group sends a write cache request to the second application program, wherein the write cache request carries a cache identifier and cache content corresponding to data to be cached by the first application program; and establishing a corresponding relation between the cache identifier corresponding to the data to be cached and the second application program, and storing the corresponding relation.
Example IV
As shown in fig. 4, an apparatus for sharing a cache between application programs includes:
a data determining module 401, configured to determine data that needs to be read from a cache by a first application in an application group, where the application group is an application group that is established and shares the cache;
and the read cache module 402 is configured to determine a second application program that provides a private cache for the data to be read, and read the data to be read from the private cache of the second application program.
In one embodiment, the application group includes an administrator, which is one application in the application group that is in a startup state.
In one embodiment, the manager is the earliest launched application in the application group.
In one embodiment, the administrator establishes a communication connection with other applications in a startup state.
In one embodiment, after an application having a communication connection with the manager is closed, the communication connection between the manager and the closed application is deleted.
In one embodiment, if the first application is an administrator of the application program group, determining a second application program that provides private caching for the data to be read includes:
And the first application program queries the corresponding relation between the cache identifier and the application program providing the private cache according to the cache identifier of the data to be read, and determines a second application program providing the private cache for the data to be read according to the query result.
In one embodiment, if the first application is not an administrator of the application program group, determining a second application program that provides private caching for the data to be read includes:
the first application program sends a data reading request to an administrator of the application program group, the administrator inquires the corresponding relation between a cache identifier and an application program providing private cache according to the cache identifier of the data to be read, and a second application program providing private cache for the data to be read is determined according to the inquired result; the data reading request carries a cache identifier corresponding to the data to be read.
In one embodiment, reading the data to be read from the private cache of the second application program includes:
and the manager of the application program group sends a read cache request to the second application program, wherein the read cache request carries a cache identifier corresponding to the data to be read, and the second application program reads the data from the private cache of the second application program according to the cache identifier of the data to be read and returns the data to the manager of the application program group.
In the technical solution of this embodiment, for an application program group that shares a cache, private caches of respective application programs become the shared cache in the application program group, and when any one application program in the application program group wants to read cache data, the application program that provides the private cache is determined by the cache identifier of the data, and data is read from the cache of the application program that provides the private cache. By equally dividing the storage tasks among the plurality of private caches, overburdening of the caches of a single application can be avoided.
Example five
The embodiment provides a device for sharing cache between application programs, which comprises:
the method comprises the steps of a memory, a processor and a processing program which is stored in the memory and can share a buffer between application programs running on the processor, wherein the processing program which shares the buffer between the application programs realizes the method for sharing the buffer between the application programs when being executed by the processor: determining data which needs to be written into a cache by a first application program in an application program group, wherein the application program group is an established application program group sharing the cache; and selecting at least one started second application program from the application program group, and storing the data needing to be cached in the private cache of the second application program.
Other features of the method for sharing a cache between application programs are the same as those of the first embodiment.
Example six
The embodiment provides a device for sharing cache between application programs, which comprises:
the method comprises the steps of a memory, a processor and a processing program which is stored in the memory and can share a buffer between application programs running on the processor, wherein the processing program which shares the buffer between the application programs realizes the method for sharing the buffer between the application programs when being executed by the processor: determining data which needs to be read from a cache by a first application program in an application program group, wherein the application program group is an established application program group sharing the cache; and determining a second application program which provides a private cache for the data to be read, and reading the data to be read from the private cache of the second application program.
Other features of the method for sharing cache between application programs are the same as those of the second embodiment.
Example seven
The present embodiment provides a computer-readable storage medium, on which a program for sharing a cache between application programs is stored, where the program for sharing the cache between application programs, when executed by a processor, implements the steps of a method for sharing the cache between application programs: determining data which needs to be written into a cache by a first application program in an application program group, wherein the application program group is an established application program group sharing the cache; and selecting at least one started second application program from the application program group, and storing the data needing to be cached in the private cache of the second application program.
Other features of the method for sharing a cache between application programs are the same as those of the first embodiment.
Example eight
The present embodiment provides a computer-readable storage medium, on which a program for sharing a cache between application programs is stored, where the program for sharing the cache between application programs, when executed by a processor, implements the steps of a method for sharing the cache between application programs: determining data which needs to be read from a cache by a first application program in an application program group, wherein the application program group is an established application program group sharing the cache; and determining a second application program which provides a private cache for the data to be read, and reading the data to be read from the private cache of the second application program.
Other features of the method for sharing cache between application programs are the same as those of the second embodiment.
The method of sharing a cache between applications is described in detail below by way of example.
Example 1
As shown in fig. 5, the present example provides a method for configuring an application group sharing a cache, including the following steps S201 to S206:
step S201, an application program group of a shared cache is established;
the user can configure a plurality of application programs to form an application program group of a shared cache in a self-defined way; for example, assuming that the user configures the applications a, B, C, D, E, F as a group of applications sharing a cache, a communication connection is established between the applications a, B, C, D, E, F through the same software development kit (Software Development Kit, SDK);
Step S202, monitoring the starting and closing of the application programs in the application program group, executing step S203 when the starting of the application programs is monitored, and executing step S206 when the closing of the application programs is monitored;
the SDK commonly used by the application programs A, B, C, D, E and F is provided with a monitoring channel for monitoring the starting or closing of each application program;
step S203, judging whether the newly started application program is the earliest started application program in all the started application programs in the application program group, if so, executing step S204, otherwise, executing step S205;
step S204, determining the newly started application program as an administrator, and returning to step S202;
step S205, establishing communication connection between the newly started application program and the manager, and returning to step S202;
step S206, judging whether the application program is a manager, if yes, executing step S207, otherwise, executing step S208;
step S207, determining the earliest started application program in other started application programs in the application program group as a new manager, deleting the communication connection between each started application program in the application program group and the old manager, newly establishing the communication connection between each started application program in the application program group and the new manager, and returning to the step S202;
Step S208, deleting the communication connection between the application program and the manager, and returning to step S202;
example 2
As shown in fig. 6, after the configuration of the application program group sharing the cache is completed, if any one of the application programs in the application program group wants to write data into the cache, the present example provides a method for caching data, which includes the following steps S301 to S305:
step S301, when any one application program in an application program group needs to write data into a cache, the application program is used as a first application program to generate a cache identification and cache content according to the data to be cached;
assuming that the application program C wants to cache the mobile phone number (13645678911) of Zhang three, the application program C is used as a first application program to generate a cache mark of Zhang three according to the data to be cached, and the cache content is 13645678911;
step S302, the first application program judges whether the first application program is a manager or not, if yes, step S304 is executed, otherwise step S303 is executed;
step S303, the first application program sends a data caching request to a manager, wherein the data caching request carries a caching identifier and caching content corresponding to data to be cached;
For example, assuming that the manager is application a, application C sends a data cache request to the manager, where the data cache request carries a cache identifier (Zhang three cell phone number) and cache content (13645678911);
step S304, the manager selects an already started application program from the application program group as a target application program for providing private cache, namely, a second application program;
step S305, the manager sends a write cache request to the second application program, where the write cache request carries a cache identifier corresponding to data to be cached and cache content, establishes a correspondence between the cache identifier corresponding to the data to be cached and a target application program providing private cache, and stores the correspondence;
wherein it is assumed that the already launched application comprises: application programs A, B, C, D; the manager (application a) may randomly select an application (e.g., selected application B) from among the already started applications a, B, C, D as a target application for providing private caching;
the manager (application program A) sends a write cache request to a target application program (application program B), wherein the write cache request carries a cache identifier (Zhang three mobile phone number) and cache content (13645678911);
The manager establishes a corresponding relation between a cache identifier (Zhang three mobile phone number) and a target application program (application program B) for providing private cache and stores the corresponding relation;
step S306, after the second application program receives the request for writing the cache, writing the cache content into the private cache of the application program;
wherein, after receiving the write cache request, the second application program (application program B) writes the cache content (13645678911) into its own private cache.
Example 3
As shown in fig. 7, after the configuration of the application program group sharing the cache is completed, if any one of the application programs in the application program group wants to read data from the cache, the present example provides a method for reading cache data, including the following steps S401 to S411:
step S401, an application program that wants to read the cached data determines, as a first application program, a cache identification of the data to be read;
if the application program C wants to read the mobile phone number of Zhang Sanhe, the application program C is used as a first application program to determine that the cache identification of the data to be read is the mobile phone number of Zhang Sanhe;
step S402, the first application program determines whether it is a manager, if so, step S404 is executed, otherwise step S403 is executed;
Step S403, the first application program sends a cache read request to a manager, where the cache read request carries a cache identifier of data to be read;
for example, assuming that the manager is application a, application C sends a cache read request to the manager, where the cache read request carries a cache identifier (Zhang three cell phone number);
step S404, the manager inquires the corresponding relation between the cache identifier and the application program providing the private cache according to the cache identifier of the data to be read;
step S405, after the administrator queries an application program that provides a private cache, the queried application program is used as a second application program, and whether the second application program is started is determined, if yes, step S407 is executed, otherwise step S406 is executed;
step S406, the manager starts the second application program;
step S407, the manager sends a read cache request to the second application program, where the read cache request carries a cache identifier corresponding to the data to be read;
assuming that the mobile phone number of Zhang three is cached in the private cache of the application program B, the manager (the application program A) sends a cache reading request to the application program B, wherein the cache reading request carries a cache identification (the mobile phone number of Zhang three);
Step S408, the second application program reads the data from the private cache according to the cache identifier, and returns the data to the manager;
the second application program reads the cache according to the cache identification (Zhang three mobile phone number) to obtain cache content (13645678911), and returns the cache content (13645678911) to the manager (application program A);
step S409, the manager sends the data to the first application program;
wherein the manager (application a) returns the cached content (13645678911) to application C.
Step S410, the manager judges whether the second application program is started by the manager, if yes, step S411 is executed, otherwise, the process is ended;
step S411, closing the second application.
Although the embodiments of the present invention are described above, the embodiments are only used for facilitating understanding of the present invention, and are not intended to limit the present invention. Any person skilled in the art can make any modification and variation in form and detail without departing from the spirit and scope of the present disclosure, but the scope of the present disclosure is to be determined by the appended claims.

Claims (18)

1. A method of sharing a cache between applications, comprising:
determining data which needs to be written into a cache by a first application program in an application program group, wherein the application program group is an established application program group sharing the cache; the application program group comprises an administrator, and the administrator is one application program in a starting state in the application program group;
selecting at least one started second application program from the application program group, wherein an administrator of the application program group sends a write cache request to the second application program, and the write cache request carries a cache identifier and cache content corresponding to data to be cached by the first application program;
and establishing a corresponding relation between the cache identifier corresponding to the data to be cached and the second application program, and storing the corresponding relation.
2. The method according to claim 1, characterized in that:
the manager is the earliest launched application in the application group.
3. The method according to claim 1, characterized in that:
the manager establishes a communication connection with other applications in a startup state.
4. A method according to claim 3, characterized in that the method further comprises:
And after the application program with the communication connection with the manager is closed, deleting the communication connection between the manager and the closed application program.
5. The method according to claim 1, characterized in that:
if the first application program is an administrator of the application program group, selecting at least one second application program which is started from the application program group, wherein the second application program comprises:
the first application program generates a cache identification and cache content according to data to be cached;
the first application program selects at least one application program which is started from the application program group as a second application program for providing private cache.
6. The method according to claim 1, characterized in that:
if the first application program is not an administrator of the application program group, selecting at least one second application program which is started from the application program group, wherein the second application program comprises:
the first application program generates a cache identification and cache content according to data to be cached;
and the first application program sends a data caching request to an administrator of the application program group, and the administrator selects at least one started application program from the application program group as a second application program for providing private caching, wherein the data caching request carries a caching identifier and caching content corresponding to data to be cached.
7. A method of sharing a cache between applications, comprising:
determining data which needs to be read from a cache by a first application program in an application program group, wherein the application program group is an established application program group sharing the cache; the application program group comprises an administrator, and the administrator is one application program in a starting state in the application program group;
determining a second application program for providing private cache for the data to be read, wherein an administrator of the application program group sends a read cache request to the second application program, the read cache request carries a cache identifier corresponding to the data to be read, and the second application program reads the data from the private cache of the second application program according to the cache identifier of the data to be read and returns the data to the administrator of the application program group.
8. The method according to claim 7, wherein:
the manager is the earliest launched application in the application group.
9. The method according to claim 7, wherein:
the manager establishes a communication connection with other applications in a startup state.
10. The method according to claim 9, wherein the method further comprises:
and after the application program with the communication connection with the manager is closed, deleting the communication connection between the manager and the closed application program.
11. The method according to claim 7, wherein:
if the first application program is the manager of the application program group, determining a second application program for providing private cache for the data to be read, including:
and the first application program queries the corresponding relation between the cache identifier and the application program providing the private cache according to the cache identifier of the data to be read, and determines a second application program providing the private cache for the data to be read according to the query result.
12. The method according to claim 7, wherein:
if the first application is not an administrator of the application group, determining a second application providing private caching for the data to be read, including:
the first application program sends a data reading request to an administrator of the application program group, the administrator inquires the corresponding relation between a cache identifier and an application program providing private cache according to the cache identifier of the data to be read, and a second application program providing private cache for the data to be read is determined according to the inquired result; the data reading request carries a cache identifier corresponding to the data to be read.
13. An apparatus for sharing a cache between applications, comprising:
the data determining module is used for determining data which needs to be written into the cache by a first application program in the application program group, wherein the application program group is an established application program group sharing the cache; the application program group comprises an administrator, and the administrator is one application program in a starting state in the application program group;
the system comprises a write cache module, a first application program group and a second application program group, wherein the write cache module is used for selecting at least one started second application program from the application program group, a manager of the application program group sends a write cache request to the second application program, and the write cache request carries a cache identifier and cache content corresponding to data to be cached by the first application program; and establishing a corresponding relation between the cache identifier corresponding to the data to be cached and the second application program, and storing the corresponding relation.
14. An apparatus for sharing a cache between applications, comprising:
the data determining module is used for determining data which needs to be read from the cache by a first application program in the application program group, wherein the application program group is an established application program group sharing the cache; the application program group comprises an administrator, and the administrator is one application program in a starting state in the application program group;
The read cache module is used for determining a second application program which provides private caches for the data to be read, the manager of the application program group sends a read cache request to the second application program, the read cache request carries a cache identifier corresponding to the data to be read, and the second application program reads the data from the private caches of the second application program according to the cache identifier of the data to be read and returns the data to the manager of the application program group.
15. An apparatus for sharing a cache between applications, comprising:
memory, a processor and a process program stored on the memory and capable of sharing a cache between applications running on the processor, the process program sharing a cache between applications implementing the steps of the method of sharing a cache between applications as claimed in any one of claims 1-6 when executed by the processor.
16. An apparatus for sharing a cache between applications, comprising:
memory, a processor and a process program stored on the memory and being capable of sharing a cache between applications running on the processor, the process program sharing a cache between applications, when executed by the processor, implementing the steps of the method of sharing a cache between applications according to any of claims 7-12.
17. A computer readable storage medium, wherein a program for sharing a cache between application programs is stored on the computer readable storage medium, and the program for sharing a cache between application programs, when executed by a processor, implements the steps of the method for sharing a cache between application programs according to any one of claims 1-6.
18. A computer readable storage medium, wherein a program for sharing a cache between application programs is stored on the computer readable storage medium, and the program for sharing a cache between application programs, when executed by a processor, implements the steps of the method for sharing a cache between application programs according to any one of claims 7-12.
CN201711038744.2A 2017-10-30 2017-10-30 Method and device for sharing cache between application programs Active CN109726017B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711038744.2A CN109726017B (en) 2017-10-30 2017-10-30 Method and device for sharing cache between application programs

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711038744.2A CN109726017B (en) 2017-10-30 2017-10-30 Method and device for sharing cache between application programs

Publications (2)

Publication Number Publication Date
CN109726017A CN109726017A (en) 2019-05-07
CN109726017B true CN109726017B (en) 2023-05-26

Family

ID=66291474

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711038744.2A Active CN109726017B (en) 2017-10-30 2017-10-30 Method and device for sharing cache between application programs

Country Status (1)

Country Link
CN (1) CN109726017B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101739298A (en) * 2008-11-27 2010-06-16 国际商业机器公司 Shared cache management method and system
CN104461932A (en) * 2014-11-04 2015-03-25 浪潮电子信息产业股份有限公司 Directory cache management method for big data application
CN105740164A (en) * 2014-12-10 2016-07-06 阿里巴巴集团控股有限公司 Multi-core processor supporting cache consistency, reading and writing methods and apparatuses as well as device
CN107229593A (en) * 2016-03-25 2017-10-03 华为技术有限公司 The buffer consistency operating method and multi-disc polycaryon processor of multi-disc polycaryon processor

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7984248B2 (en) * 2004-12-29 2011-07-19 Intel Corporation Transaction based shared data operations in a multiprocessor environment
JP5225010B2 (en) * 2008-10-14 2013-07-03 キヤノン株式会社 Interprocessor communication method, multiprocessor system, and processor.

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101739298A (en) * 2008-11-27 2010-06-16 国际商业机器公司 Shared cache management method and system
CN104461932A (en) * 2014-11-04 2015-03-25 浪潮电子信息产业股份有限公司 Directory cache management method for big data application
CN105740164A (en) * 2014-12-10 2016-07-06 阿里巴巴集团控股有限公司 Multi-core processor supporting cache consistency, reading and writing methods and apparatuses as well as device
CN107229593A (en) * 2016-03-25 2017-10-03 华为技术有限公司 The buffer consistency operating method and multi-disc polycaryon processor of multi-disc polycaryon processor

Also Published As

Publication number Publication date
CN109726017A (en) 2019-05-07

Similar Documents

Publication Publication Date Title
CN111464355A (en) Method and device for controlling expansion capacity of Kubernetes container cluster and network equipment
CN107832100B (en) APK plug-in loading method and terminal thereof
CN103139255B (en) The method of Resources allocation mark and identification section
CN105760199B (en) A kind of application resource loading method and its equipment
CN103716383A (en) Method and device for accessing shared resources
US10224972B2 (en) Systems, methods, and computer-readable media for tracking updates and loading data
CN110781149A (en) Method, device, equipment and storage medium for managing live broadcast room information
CN107992270B (en) Method and device for globally sharing cache of multi-control storage system
CN111078410A (en) Memory allocation method and device, storage medium and electronic equipment
CN114710549B (en) Dynamic management method, system and service node for network card in container platform
CN115098426A (en) PCIE (peripheral component interface express) equipment management method, interface management module, PCIE system, equipment and medium
CN105653556B (en) Data aging method and device
CN109726017B (en) Method and device for sharing cache between application programs
CN114745275A (en) Node updating method and device in cloud service environment and computer equipment
CN106549983B (en) Database access method, terminal and server
CN112035720A (en) Event reminding triggering method and device, storage medium and electronic equipment
CN107534678B (en) Method, device and system for establishing connection between VNFM and VIM
CN109254858B (en) Data sharing method, device and equipment of active window and storage medium
CN112367412B (en) Equipment connection management method and device based on Internet of things
CN114880717A (en) Data archiving method and device
CN114585035A (en) Voice call method, device and computer readable storage medium
CN110661892B (en) Domain name configuration information processing method and device
CN113505111A (en) Shared directory mounting method and distributed network additional storage system
CN110247992B (en) Address updating method and device, terminal and server
CN108196962B (en) Method and device for realizing calling of interfaces of different versions

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
GR01 Patent grant
GR01 Patent grant