WO2023160289A1 - Mini-program storage call - Google Patents

Mini-program storage call Download PDF

Info

Publication number
WO2023160289A1
WO2023160289A1 PCT/CN2023/071496 CN2023071496W WO2023160289A1 WO 2023160289 A1 WO2023160289 A1 WO 2023160289A1 CN 2023071496 W CN2023071496 W CN 2023071496W WO 2023160289 A1 WO2023160289 A1 WO 2023160289A1
Authority
WO
WIPO (PCT)
Prior art keywords
storage
applet
cache
client
call request
Prior art date
Application number
PCT/CN2023/071496
Other languages
French (fr)
Chinese (zh)
Inventor
曾家龙
Original Assignee
支付宝(杭州)信息技术有限公司
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 支付宝(杭州)信息技术有限公司 filed Critical 支付宝(杭州)信息技术有限公司
Publication of WO2023160289A1 publication Critical patent/WO2023160289A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44589Program code verification, e.g. Java bytecode verification, proof-carrying code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons

Definitions

  • This specification relates to the field of Internet technology, especially the storage and calling of applets.
  • the client of an application can mount the corresponding applets of other different applications, so that users can realize the control of other applications in the client of this application only through the applets of other applications without installing the client. operations to provide convenience to users.
  • the operation of the applet it needs to borrow the storage space of the client to store data and interact frequently with the client. Based on this, a more efficient applet storage and calling scheme is needed.
  • One or more embodiments of this specification provide a method, device, device, and storage medium for storing and calling applets to solve the following technical problem: a more efficient solution for storing and calling applets is needed.
  • a method for storing and invoking an applet provided by one or more embodiments of this specification, the applet runs on a client, and the method includes: before the applet initiates a storage API call request to the client , access the cache of the applet itself; check whether the storage data targeted by the storage API call request is stored in the cache of the applet itself; if so, filter out the storage API call for the client Request, and according to the storage data in the cache of the applet itself, implement the storage-related operation corresponding to the storage API call request; otherwise, initiate the storage API call request to the client.
  • a device for storing and invoking a small program provided by one or more embodiments of this specification, the small program runs on a client, and the device includes: an access module, when the small program wants to initiate a storage API to the client Before calling the request, access the cache of the applet itself; the verification module checks whether the storage data targeted by the storage API call request is saved in the cache of the applet itself; the implementation module, in the verification If the result of the module is yes, filter out the storage API call request for the client, and realize the storage correlation corresponding to the storage API call request according to the storage data in the cache of the applet itself. Operation: the initiating module, when the result of the verification module is negative, initiates the storage API call request to the client.
  • a device for storing and invoking an applet provided by one or more embodiments of the present specification, the applet runs on a client, and the device includes at least one processor and a memory communicatively connected to the at least one processor.
  • the memory stores instructions executable by the at least one processor, the instructions are executed by the at least one processor, so that the at least one processor can: Before initiating a storage API call request, access the cache of the applet itself; check whether the storage data targeted by the storage API call request is stored in the cache of the applet itself; if so, filter for the client Call the storage API request, and implement the storage-related operations corresponding to the storage API call request according to the storage data in the cache of the applet itself; otherwise, initiate the storage API call to the client ask.
  • a non-volatile computer storage medium stores computer-executable instructions, and the computer-executable instructions are set to: when the applet is to initiate a storage API to the client Before calling the request, access the cache of the applet itself; check whether the storage data targeted by the storage API call request is saved in the cache of the applet itself; if so, filter out the cache for the client storing the API call request, and implementing a storage-related operation corresponding to the storage API call request according to the stored data in the cache of the applet itself; otherwise, initiating the storage API call request to the client.
  • the applet when the applet needs to call the stored data, it first checks the cache of the applet itself to determine whether the required data exists. If it exists, it can be called directly without requesting the client to call it. If it does not exist, initiate a storage API call request to the client. This can improve the efficiency of small program storage data calls, especially for repeated writing and reading of stored data, and reduce unnecessary interaction between the small program and the client, thereby reducing additional communication overhead and small program running performance Overhead, improve the smoothness of the running of the applet, and improve the running of the applet.
  • Fig. 1 is a schematic flowchart of a method for storing and invoking a small program provided by one or more embodiments of this specification;
  • Figure 2a is a schematic diagram of storage writing in an application scenario
  • Fig. 2b is a schematic diagram of storage asynchronous writing in an application scenario provided by one or more embodiments of this specification;
  • FIG. 3 is a schematic diagram of wrong key recording in an application scenario provided by one or more embodiments of this specification;
  • Fig. 4 is a detailed flowchart of the method in Fig. 1 in an application scenario provided by one or more embodiments of this specification;
  • Fig. 5 is a schematic structural diagram of a small program storage and calling device provided by one or more embodiments of this specification;
  • Fig. 6 is a schematic structural diagram of a device for storing and invoking applets provided by one or more embodiments of this specification.
  • Embodiments of this specification provide a method, device, device, and storage medium for storing and invoking applets.
  • the cache of the applet itself is first checked to determine that there is a corresponding cache in the cache of the applet itself.
  • it can be called directly from the applet's own cache without sending a storage API call request to the client.
  • it initiates a storage API call request to the client.
  • the communication interaction between the applet and the client can be reduced, the communication overhead can be reduced, the efficiency of calling the stored data of the applet can be improved, and the response rate of the applet can be improved.
  • Fig. 1 is a schematic flowchart of a method for storing and invoking an applet provided by one or more embodiments of this specification.
  • the method can be applied to different business fields, such as e-commerce business fields, instant messaging business fields, official business fields, payment business fields, and the like.
  • This process can be executed by computing devices in the corresponding field (such as mobile terminals held by users in payment services, etc.), and some input parameters or intermediate results in the process allow manual intervention and adjustment to help improve accuracy.
  • the flow in Fig. 1 may include the following steps.
  • the relationship between the applet and the client is a dependent and dependent relationship.
  • the applet runs on the client, stores data through the client’s storage space, and communicates with the client based on the storage API provided by the client. Interact and call the stored data.
  • the cache of the applet itself is a temporary storage dependent on the applet itself, and generally exists in a terminal held by a user, such as a mobile phone, a tablet computer, a computer, and the like.
  • the storage space of the client usually also includes the storage space hosted in the server.
  • the cache of the applet itself exists with the life cycle of the applet, and has nothing to do with the storage space of the client. Wherein, the life cycle of the applet indicates the duration of the applet in the client from being activated to being stopped during one use.
  • the applet When the applet calls the stored data from its own cache, it can directly call without calling the storage API, which can improve the efficiency of stored data calls, improve the response rate of the applet, and reduce the communication between the applet and the client. unnecessary interaction and reduce the workload of interaction. Therefore, the storage of the applet in its own cache may also be referred to as near-end storage.
  • S104 Check whether the storage data targeted by the storage API call request is stored in the cache of the applet itself.
  • the applet When the applet needs to call the stored data, it can first check the cache of the applet itself to determine whether the required stored data is stored in it, so as to determine whether it is necessary to call the client's storage API.
  • the verification method can be determined by the form of the stored data, such as matching according to the key-value pairs of the stored data.
  • the applet can directly obtain the required storage data from its own cache without sending a storage API call request to the client. Afterwards, the applet can perform storage-related operations according to the stored data in its own cache, including storage write operations, storage read operations, storage update operations, storage delete operations, and the like.
  • the mini-program needs to initiate a storage API call request to the client to obtain the required storage data from the client's storage space.
  • the applet when the applet needs to call the stored data, it first checks the cache of the applet itself to determine whether the required data exists. If it exists, it can be called directly without requesting the client to call it. If it does not exist, initiate a storage API call request to the client. This can improve the efficiency of small program storage data calls, especially for repeated writing and reading of stored data, and reduce unnecessary interaction between the small program and the client, thereby reducing additional communication overhead and small program running performance Overhead, improve the smoothness of the running of the applet, and improve the running of the applet.
  • the applet when the applet executes the storage write operation, it respectively executes the storage write operation on the cache of the applet itself and the client.
  • the store write operation is performed on the cache of the applet itself, so as to write the data to be written corresponding to the applet into the cache of the applet itself.
  • a storage API call request is initiated to the client, so that the client also executes a storage write operation to persist the data to be written corresponding to the applet in the storage space corresponding to the client.
  • the cache of the applet itself is relatively independent from the storage space of the client.
  • the storage space corresponding to the client does not belong to the applet and does not include the cache of the applet itself.
  • the stored data in the mini program's own cache is temporary storage, which disappears with the termination of the mini program's life cycle, and the stored data in the client's storage space is persistent storage, which does not change with the change of the mini program's life cycle.
  • the applet can directly call the stored data from its own cache, which is convenient and fast, and improves the efficiency of calling, and the stored data is also written into the storage space of the client, and the stored data can be processed.
  • Persistent storage so that when the next life cycle of the applet is started, the relevant storage memory can be retained to provide convenience for users.
  • the applet when the applet performs a storage write operation to the client, it generates risk filling data according to the data to be written corresponding to the applet. According to the risk filling data, initiate a storage API call request to the client, so that the client first persists the risk filling data in the corresponding storage space of the client, and at the end of the life cycle of the applet, also executes the storage write Operation, replace the persistent risk filling data in the storage space corresponding to the client with the data to be written corresponding to the applet.
  • the risk-filled data refers to the data that is related to the data to be written but hides the real information in the data to be written. Specifically, according to the set corresponding relationship, the data to be written can be split, converted, sequenced, etc. to obtain the risk filling data.
  • the risk filling data can be represented as data completely irrelevant to the data to be written, or as data containing non-private parts of the data to be written.
  • the client's storage space stores risk-filled data, that is, the client cannot know the real information in the data to be written, which can ensure the security of the data to be written, even if the client exists.
  • the risk of data leakage, but the real information of the data to be written will not be leaked.
  • the stored risk filling data is replaced with the data to be written, which ensures that the client can store the data to be written generated by the applet.
  • this storage method can ensure that the data stored in the client's storage space is the latest stored data in the life cycle of the applet, avoiding the fact that the stored data in the client's storage space is not updated, and there is a contradiction with the stored data required by the applet The problem.
  • the applet when it performs a storage write operation to its own cache and the client respectively, it sends a storage API call request to the client asynchronously compared to performing a storage write operation to the cache of the applet itself. Also, after the store write operation is performed on the applet's own cache, the data written by the store write operation can be read from the applet's own cache immediately. It should be noted that in the past, if the applet directly made this kind of write to the client (in the past, the synchronous write call was executed), the data just written should be read immediately, because the applet calls the storage API of the client to execute the storage write The input operation takes a long time, so it may block the subsequent read operation, but this problem is solved in this solution. By executing the storage write operation asynchronously, the stored data can be read immediately after the stored data is written into the Mini Program's own cache, ensuring the smoothness of storage writing and reading, and improving the response efficiency of the Mini Program.
  • the applet when the applet performs a storage write operation, it first writes the data to be written into the cache of the applet itself (ie, the near-end cache). Since the writing time of the near-end cache is short and fast, the written storage data can be read immediately afterwards. Afterwards, asynchronously writing the data to be written into the storage space of the client will not affect the storage read operation.
  • the applet when the applet performs a storage read operation, after verifying the applet's own cache, it can directly read the stored data from the applet's own cache and return it to the applet. This can avoid repeated calls to the client storage API when reading data, save the performance overhead of the applet, and improve the data call efficiency of the applet.
  • an applet cache management object can also be generated for the cache of the applet itself according to the base class of the storage cache manager, so that Use the applet to cache the instance of the management object, access the cache of the applet itself, and perform verification.
  • a plug-in cache management object can also be generated for the cache of the plug-in of the application, wherein the client belongs to the application or another application.
  • the storage API call request and/or the specified application identifier select the target object from the applet cache management object and the plug-in cache management object, so as to determine that the storage API call request is initiated through the applet or the plug-in.
  • the plug-in cache management object can manage the cache allocated for the plug-in itself, and then temporarily store and access the data of the plug-in in the cache, thereby reducing the plug-in's impact on its client or other applications. disturb.
  • the client can filter out the operation after verification in the cache of the applet itself.
  • the cache of the applet itself runs in the life cycle of the applet, and when the life cycle of the applet ends, the cache of the applet itself is destroyed, so that the stored data in the cache of the applet itself is lost.
  • the stored data in the client's storage space is not affected by the end of the applet's life cycle, so that the stored data can continue to be called when the next life cycle of the applet starts. Since the near-end cache of the applet only exists in the life cycle of the applet, if the near-end cache data is destroyed at the end of the life cycle of the applet, there will be no persistence problem of the cache data, which is different from the old and new cache data. contradiction problem.
  • stored data includes keys in key-value pairs.
  • the storage-related operation performed by the applet is a storage read operation
  • the client responds to the storage API call request and executes the storage read operation, it fails to read the value of the key, indicating that the storage data does not exist corresponding to the key. value, the key is determined to be an incorrect key and recorded, so as to filter out storage API call requests for reading the value of the incorrect key, and avoid subsequent repeated execution of storage read operations on the incorrect key.
  • After writing a value for the wrong key by performing a storage write operation, indicating that the wrong key already has a corresponding value in the stored data it can be determined that the key is no longer a wrong key, and the record can be modified .
  • the applet when the applet performs a storage read operation, it records the error key according to the result of the read failure to form the storage data of the error key array. After the subsequent applet executes the storage write operation and corrects the wrong key, it can delete the wrong key recorded in the wrong key array.
  • one or more embodiments of this specification provide a detailed flow diagram of the method in Figure 1 in an application scenario, in which some of the previous optional solutions are used, and the process is shown in Figure 4 Show.
  • the applet when the applet calls the storage API for the first time, it checks in the cache of the applet itself according to the key-value pair (Key-Value, KV) corresponding to the data to be written. test to determine if the same key-value pair exists.
  • KV Key-Value
  • the applet needs to write the key-value pair corresponding to the data to be written into the cache of the applet itself, and also into the storage space of the client. For example, you can communicate with the client through JSAPI CALL BRIDGE to call the storage API.
  • the applet calls the storage API again, it checks in the cache of the applet itself according to the data to be written to determine whether the same key-value pair KV exists. If there is the same key-value pair, it means that the applet has written the data to be written into the cache of the applet itself. If the applet is not treating the data to be written or it is the first call, it can directly return the verification in the cache of the applet itself. result. If the same key-value pair does not exist, it means that the applet has not stored the data in its own cache, that is, the data has not been stored in the client's storage space, then write the data to be written into the cache of the applet itself and in the storage space of the client.
  • the storage read operation For the storage read operation, according to the key of the data to be read, check whether there is a corresponding value in the cache of the applet itself. If there is a value corresponding to the key to be read, the corresponding value can be directly returned to the applet. If there is no value corresponding to the key to be read, then call the storage API of the client to query the corresponding value in the storage space of the client.
  • one or more embodiments of this specification also provide devices and devices corresponding to the above method, as shown in FIG. 5 and FIG. 6 .
  • Fig. 5 is a schematic structural diagram of a device for storing and invoking a small program provided by one or more embodiments of this specification.
  • the small program runs on the client, and the device includes: an access module 502.
  • the verification module 504 checks whether the storage data targeted by the storage API call request is stored in the cache of the applet itself;
  • the initiating module 508 when the result of the verification module 504 is negative, initiates the storage API call request to the client.
  • the storage-related operation is a storage write operation
  • the initiating module 508 executes the storage write operation on the cache of the applet itself, so as to write the data to be written corresponding to the applet, Write in the cache of the applet itself; initiate the storage API call request to the client, so that the client also executes the storage write operation, and writes the to-be-written data corresponding to the applet
  • the data is persisted in the storage space corresponding to the client, and the storage space corresponding to the client does not belong to the applet and does not include the cache of the applet itself.
  • the initiating module 508 generates risk filling data according to the data to be written corresponding to the applet; according to the risk filling data, initiates the storage API call request to the client, so that all The client first persists the risk filling data in the storage space corresponding to the client, and at the end of the life cycle of the applet, by also executing the storage write operation, the client The risk filling data persisted in the corresponding storage space is replaced with the data to be written corresponding to the applet.
  • the initiating module 508 relative to executing the storage write operation on the cache of the applet itself, sends the storage API call request to the client asynchronously; the device also includes immediate reading module 510, the immediate read module 510, after the initiating module 508 executes the storage write operation on the cache of the applet itself, executes: immediately read from the cache of the applet itself through the storage The data written by the write operation.
  • the storage-related operation is a storage read operation; the realization module 506 reads the stored data from the cache of the applet itself, and returns it to the applet.
  • the device may further include a generation module 512, and before the verification module 504 verifies whether the storage data targeted by the storage API call request is stored in the cache of the applet itself, execute: According to the base class of the storage cache manager, an applet cache management object is generated for the cache of the applet itself, so that the cache of the applet itself can be accessed through the instance of the applet cache management object, and the calibration can be executed. test.
  • the device further includes a selection module 514, before the verification module 504 verifies whether the storage data targeted by the storage API call request is saved in the cache of the applet itself , execute: generate a plug-in cache management object for the plug-in cache of the application according to the base class of the storage cache manager, wherein the client belongs to the application or another application; call the request and/or specify according to the storage API The application identifier of the application, and select a target object from the applet cache management object and the plug-in cache management object.
  • the apparatus may further include a determination module 516, and before the implementation module 506 filters out the storage API call request for the client, the determination module 516: determines that the storage-related operation is not a storage erasure operation;
  • the device also includes a clearing module 518, and the clearing module 518 executes: if the storage-related operation is a storage erase operation, clear the stored data in the cache of the applet itself; storing the API call request, so that the stored data persisted by the client outside the cache is also cleared.
  • the stored data includes a key in a key-value pair, and the storage-related operation is a storage read operation; the device further includes an error recording module 520, and the error recording module 520 sends an error message to the initiating module 508
  • the cache of the applet itself runs in the life cycle of the applet
  • the device further includes a destroying module 522, and the destroying module 522 executes: when the life cycle of the applet ends, destroy The applet's own cache, and thus the stored data in the applet's own cache, is lost.
  • Fig. 6 is a schematic structural diagram of a device for storing and invoking a small program provided by one or more embodiments of this specification.
  • the small program runs on a client, and the device includes: at least one processor; A memory communicatively connected to a processor; wherein the memory stores instructions executable by the at least one processor, the instructions are executed by the at least one processor, so that the at least one processor can: Before the applet initiates a storage API call request to the client, access the cache of the applet itself; check whether the storage data targeted by the storage API call request is saved in the cache of the applet itself ; If so, filter out the storage API call request for the client, and implement the storage-related operations corresponding to the storage API call request according to the storage data in the cache of the applet itself; otherwise, send The client initiates the storage API calling request.
  • one or more embodiments of this specification also provide a non-volatile computer storage medium corresponding to the above method, which stores computer-executable instructions, and the computer-executable instructions are configured to: Before the applet initiates a storage API call request to the client, access the cache of the applet itself; check whether the storage data targeted by the storage API call request is saved in the cache of the applet itself; if , then filter out the storage API call request for the client, and implement the storage-related operations corresponding to the storage API call request according to the storage data in the cache of the applet itself; otherwise, send the The client initiates the storage API call request.
  • the improvement of a technology can be clearly distinguished as an improvement in hardware (for example, improvements in circuit structures such as diodes, transistors, and switches) or improvements in software (improvement in method flow).
  • improvements in circuit structures such as diodes, transistors, and switches
  • improvements in software improvement in method flow
  • the improvement of many current method flows can be regarded as the direct improvement of the hardware circuit structure.
  • Designers almost always get the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow cannot be realized by hardware physical modules.
  • a programmable logic device Programmable Logic Device, PLD
  • PLD Programmable Logic Device
  • FPGA Field Programmable Gate Array
  • HDL Hardware Description Language
  • ABEL Advanced Boolean Expression Language
  • AHDL Altera Hardware Description Language
  • HDCal JHDL
  • Lava Lava
  • Lola MyHDL
  • PALASM RHDL
  • VHDL Very-High-Speed Integrated Circuit Hardware Description Language
  • Verilog Verilog
  • the controller may be implemented in any suitable way, for example the controller may take the form of a microprocessor or processor and a computer readable medium storing computer readable program code (such as software or firmware) executable by the (micro)processor , logic gates, switches, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable logic controllers and embedded microcontrollers, examples of controllers include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20 and Silicone Labs C8051F320, the memory controller can also be implemented as part of the control logic of the memory.
  • controller in addition to realizing the controller in a purely computer-readable program code mode, it is entirely possible to make the controller use logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded The same function can be realized in the form of a microcontroller or the like. Therefore, such a controller can be regarded as a hardware component, and the devices included in it for realizing various functions can also be regarded as structures within the hardware component. Or even, means for realizing various functions can be regarded as a structure within both a software module realizing a method and a hardware component.
  • a typical implementing device is a computer.
  • the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or Combinations of any of these devices.
  • embodiments of this specification may be provided as methods, systems, or computer program products. Accordingly, the embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present description may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions
  • the device realizes the function specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
  • a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
  • processors CPUs
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • Memory may include non-permanent storage in computer readable media, in the form of random access memory (RAM) and/or nonvolatile memory such as read-only memory (ROM) or flash RAM. Memory is an example of computer readable media.
  • RAM random access memory
  • ROM read-only memory
  • flash RAM flash random access memory
  • Computer-readable media including both permanent and non-permanent, removable and non-removable media, can be implemented by any method or technology for storage of information.
  • Information may be computer readable instructions, data structures, modules of a program, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Flash memory or other memory technology, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic tape cartridge, tape magnetic disk storage or other magnetic storage device or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
  • computer-readable media excludes transitory computer-readable media, such as modulated data signals and carrier waves.
  • program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types.
  • the present description may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network.
  • program modules may be located in both local and remote computer storage media including storage devices.
  • each embodiment in this specification is described in a progressive manner, the same and similar parts of each embodiment can be referred to each other, and each embodiment focuses on the differences from other embodiments.
  • the description is relatively simple, and for relevant parts, please refer to the part of the description of the method embodiments.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

Embodiments of the present description disclose a mini-program storage call method and apparatus, and a device. The solution comprises: before a mini-program is about to initiate a storage API call request to a client, accessing the cache of the mini-program; verifying whether storage data with respect to the storage API call request is stored in the cache of the mini-program; if yes, filtering out the storage API call request for the client, and performing, according to the storage data in the cache of the mini-program, a storage-related operation corresponding to the storage API call request; and otherwise initiating the storage API call request to the client.

Description

小程序的存储调用Small program storage call 技术领域technical field
本说明书涉及互联网技术领域,尤其涉及小程序的存储调用。This specification relates to the field of Internet technology, especially the storage and calling of applets.
背景技术Background technique
随着技术的发展,应用集成的功能越来越多。目前,一应用的客户端中可挂载其他不同应用对应的小程序,以使用户仅通过其他应用的小程序,而无需安装客户端,即可在该应用的客户端中,实现对其他应用的操作,以向用户提供方便。小程序在运行过程中,需要借用客户端的存储空间存储数据,并与客户端进行频繁的交互。基于此,需要更加高效的小程序存储调用方案。With the development of technology, there are more and more functions of application integration. At present, the client of an application can mount the corresponding applets of other different applications, so that users can realize the control of other applications in the client of this application only through the applets of other applications without installing the client. operations to provide convenience to users. During the operation of the applet, it needs to borrow the storage space of the client to store data and interact frequently with the client. Based on this, a more efficient applet storage and calling scheme is needed.
发明内容Contents of the invention
本说明书一个或多个实施例提供一种小程序存储调用方法、装置、设备以及存储介质,用以解决如下技术问题:需要更加高效的小程序存储调用方案。One or more embodiments of this specification provide a method, device, device, and storage medium for storing and calling applets to solve the following technical problem: a more efficient solution for storing and calling applets is needed.
本说明书一个或多个实施例提供的一种小程序存储调用方法,所述小程序运行于客户端上,所述方法包括:在所述小程序要向所述客户端发起存储API调用请求之前,访问所述小程序自身的缓存;校验所述小程序自身的缓存中是否保存有所述存储API调用请求所针对的存储数据;若是,则为所述客户端过滤掉所述存储API调用请求,并根据所述小程序自身的缓存中的所述存储数据,实现所述存储API调用请求对应的存储相关操作;否则,向所述客户端发起所述存储API调用请求。A method for storing and invoking an applet provided by one or more embodiments of this specification, the applet runs on a client, and the method includes: before the applet initiates a storage API call request to the client , access the cache of the applet itself; check whether the storage data targeted by the storage API call request is stored in the cache of the applet itself; if so, filter out the storage API call for the client Request, and according to the storage data in the cache of the applet itself, implement the storage-related operation corresponding to the storage API call request; otherwise, initiate the storage API call request to the client.
本说明书一个或多个实施例提供的一种小程序存储调用装置,所述小程序运行于客户端上,所述装置包括:访问模块,在所述小程序要向所述客户端发起存储API调用请求之前,访问所述小程序自身的缓存;校验模块,校验所述小程序自身的缓存中是否保存有所述存储API调用请求所针对的存储数据;实现模块,在所述校验模块的结果为是的情况下,为所述客户端过滤掉所述存储API调用请求,并根据所述小程序自身的缓存中的所述存储数据,实现所述存储API调用请求对应的存储相关操作;发起模块,在所述校验模块的结果为否的情况下,向所述客户端发起所述存储API调用请求。A device for storing and invoking a small program provided by one or more embodiments of this specification, the small program runs on a client, and the device includes: an access module, when the small program wants to initiate a storage API to the client Before calling the request, access the cache of the applet itself; the verification module checks whether the storage data targeted by the storage API call request is saved in the cache of the applet itself; the implementation module, in the verification If the result of the module is yes, filter out the storage API call request for the client, and realize the storage correlation corresponding to the storage API call request according to the storage data in the cache of the applet itself. Operation: the initiating module, when the result of the verification module is negative, initiates the storage API call request to the client.
本说明书一个或多个实施例提供的一种小程序存储调用设备,所述小程序运行于客户端上,所述设备包括至少一个处理器以及与所述至少一个处理器通信连接的存储器。所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够:在所述小程序要向所述客户端发起存储API调用请求之前,访问所述小程序自身的缓存;校验所述小程序自身的缓存中是否保存有所述存储API调用请求所针对的存储数据;若是,则为所述客户端过滤掉所述存储API 调用请求,并根据所述小程序自身的缓存中的所述存储数据,实现所述存储API调用请求对应的存储相关操作;否则,向所述客户端发起所述存储API调用请求。A device for storing and invoking an applet provided by one or more embodiments of the present specification, the applet runs on a client, and the device includes at least one processor and a memory communicatively connected to the at least one processor. The memory stores instructions executable by the at least one processor, the instructions are executed by the at least one processor, so that the at least one processor can: Before initiating a storage API call request, access the cache of the applet itself; check whether the storage data targeted by the storage API call request is stored in the cache of the applet itself; if so, filter for the client Call the storage API request, and implement the storage-related operations corresponding to the storage API call request according to the storage data in the cache of the applet itself; otherwise, initiate the storage API call to the client ask.
本说明书一个或多个实施例提供的一种非易失性计算机存储介质,存储有计算机可执行指令,所述计算机可执行指令设置为:在所述小程序要向所述客户端发起存储API调用请求之前,访问所述小程序自身的缓存;校验所述小程序自身的缓存中是否保存有所述存储API调用请求所针对的存储数据;若是,则为所述客户端过滤掉所述存储API调用请求,并根据所述小程序自身的缓存中的所述存储数据,实现所述存储API调用请求对应的存储相关操作;否则,向所述客户端发起所述存储API调用请求。A non-volatile computer storage medium provided by one or more embodiments of this specification stores computer-executable instructions, and the computer-executable instructions are set to: when the applet is to initiate a storage API to the client Before calling the request, access the cache of the applet itself; check whether the storage data targeted by the storage API call request is saved in the cache of the applet itself; if so, filter out the cache for the client storing the API call request, and implementing a storage-related operation corresponding to the storage API call request according to the stored data in the cache of the applet itself; otherwise, initiating the storage API call request to the client.
本说明书一个或多个实施例采用的上述至少一个技术方案能够达到以下有益效果:小程序需要调用存储数据时,先对小程序自身的缓存进行校验,确定是否存在所需的数据。若存在则可直接调用,而无需向客户端请求调用。若不存在,再向客户端发起存储API调用请求。这样能够提高小程序存储数据调用的效率,特别针对存储数据的重复写入、读取等操作,减少小程序与客户端之间不必要的交互,从而减少额外的通信开销及小程序运行的性能开销,提高小程序运行的流畅性,改善小程序的运行卡顿。The above-mentioned at least one technical solution adopted by one or more embodiments of this specification can achieve the following beneficial effects: when the applet needs to call the stored data, it first checks the cache of the applet itself to determine whether the required data exists. If it exists, it can be called directly without requesting the client to call it. If it does not exist, initiate a storage API call request to the client. This can improve the efficiency of small program storage data calls, especially for repeated writing and reading of stored data, and reduce unnecessary interaction between the small program and the client, thereby reducing additional communication overhead and small program running performance Overhead, improve the smoothness of the running of the applet, and improve the running of the applet.
附图说明Description of drawings
为了更清楚地说明本说明书实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本说明书中记载的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of this specification or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only These are some embodiments described in this specification. Those skilled in the art can also obtain other drawings based on these drawings without any creative effort.
图1为本说明书一个或多个实施例提供的一种小程序存储调用方法的流程示意图;Fig. 1 is a schematic flowchart of a method for storing and invoking a small program provided by one or more embodiments of this specification;
图2a为一种应用场景下的存储写入示意图;Figure 2a is a schematic diagram of storage writing in an application scenario;
图2b为本说明书一个或多个实施例提供的,一种应用场景下的存储异步写入示意图;Fig. 2b is a schematic diagram of storage asynchronous writing in an application scenario provided by one or more embodiments of this specification;
图3为本说明书一个或多个实施例提供的,一种应用场景下的错误键记录示意图;FIG. 3 is a schematic diagram of wrong key recording in an application scenario provided by one or more embodiments of this specification;
图4为本说明书一个或多个实施例提供的一种应用场景下,图1中方法的一种详细流程示意图;Fig. 4 is a detailed flowchart of the method in Fig. 1 in an application scenario provided by one or more embodiments of this specification;
图5为本说明书一个或多个实施例提供的一种小程序存储调用装置的结构示意图;Fig. 5 is a schematic structural diagram of a small program storage and calling device provided by one or more embodiments of this specification;
图6为本说明书一个或多个实施例提供的一种小程序存储调用设备的结构示意图。Fig. 6 is a schematic structural diagram of a device for storing and invoking applets provided by one or more embodiments of this specification.
具体实施方式Detailed ways
本说明书实施例提供一种小程序存储调用方法、装置、设备以及存储介质。Embodiments of this specification provide a method, device, device, and storage medium for storing and invoking applets.
为了使本技术领域的人员更好地理解本说明书中的技术方案,下面将结合本说明书 实施例中的附图,对本说明书实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本说明书实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都应当属于本申请保护的范围。In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described The embodiments are only some of the embodiments of the present application, but not all of them. Based on the embodiments of this specification, all other embodiments obtained by persons of ordinary skill in the art without creative efforts shall fall within the scope of protection of this application.
在本说明书一个或多个实施例中,在小程序需要进行存储应用程序接口(Application Programming Interface,API)调用时,首先对小程序自身的缓存进行校验,确定小程序自身的缓存中存在对应的存储数据时,可直接从小程序自身的缓存中调用,而无需向客户端发送存储API调用请求。确定小程序自身的缓存中不存在对应的存储数据时,再向客户端发起存储API调用请求。这样能够减少小程序与客户端之间的通信交互,减少通信开销,提高小程序存储数据调用的高效性,提高小程序的反应速率。下面基于这样的思路,具体进行说明。In one or more embodiments of this specification, when the applet needs to call the application programming interface (Application Programming Interface, API), the cache of the applet itself is first checked to determine that there is a corresponding cache in the cache of the applet itself. When storing data, it can be called directly from the applet's own cache without sending a storage API call request to the client. When it is determined that there is no corresponding stored data in the mini-program's own cache, it initiates a storage API call request to the client. In this way, the communication interaction between the applet and the client can be reduced, the communication overhead can be reduced, the efficiency of calling the stored data of the applet can be improved, and the response rate of the applet can be improved. Based on this idea, the following will be described in detail.
图1为本说明书一个或多个实施例提供的一种小程序存储调用方法的流程示意图。该方法可以应用于不同的业务领域,比如,电商业务领域、即时通讯业务领域、公务业务领域、支付业务领域等。该流程可以由相应领域的计算设备(比如支付业务中用户持有的移动终端等)执行,流程中的某些输入参数或者中间结果允许人工干预调节,以帮助提高准确性。Fig. 1 is a schematic flowchart of a method for storing and invoking an applet provided by one or more embodiments of this specification. The method can be applied to different business fields, such as e-commerce business fields, instant messaging business fields, official business fields, payment business fields, and the like. This process can be executed by computing devices in the corresponding field (such as mobile terminals held by users in payment services, etc.), and some input parameters or intermediate results in the process allow manual intervention and adjustment to help improve accuracy.
图1中的流程可以包括以下步骤。The flow in Fig. 1 may include the following steps.
S102:在所述小程序要向所述客户端发起存储API调用请求之前,访问所述小程序自身的缓存。S102: Before the applet initiates a storage API call request to the client, access the cache of the applet itself.
小程序与客户端之间的关系为依赖与被依赖的关系,小程序运行于客户端上,通过客户端的存储空间进行存储数据的持久化存储,并基于客户端提供的存储API与客户端进行交互,进行存储数据的调用。The relationship between the applet and the client is a dependent and dependent relationship. The applet runs on the client, stores data through the client’s storage space, and communicates with the client based on the storage API provided by the client. Interact and call the stored data.
在本说明书一个或多个实施例中,小程序自身的缓存为依赖于小程序自身的暂时性存储,一般存在于用户持有的终端中,比如手机、平板电脑、电脑等。而客户端的存储空间通常还包括托管在服务器中的存储空间。小程序自身的缓存随小程序的生命周期而存在,与客户端的存储空间无关。其中,小程序的生命周期表示客户端中的小程序在一次使用过程中从启用到停止所持续的时间段。In one or more embodiments of this specification, the cache of the applet itself is a temporary storage dependent on the applet itself, and generally exists in a terminal held by a user, such as a mobile phone, a tablet computer, a computer, and the like. The storage space of the client usually also includes the storage space hosted in the server. The cache of the applet itself exists with the life cycle of the applet, and has nothing to do with the storage space of the client. Wherein, the life cycle of the applet indicates the duration of the applet in the client from being activated to being stopped during one use.
当小程序从自身的缓存中调用存储数据时,可直接进行调用,而无需调用存储API,这样能够提高存储数据调用的效率,提高小程序的反应速率,也减少了小程序与客户端之间的不必要的交互,减少交互工作量。因此,也可将小程序在自身的缓存中的存储称为近端存储。When the applet calls the stored data from its own cache, it can directly call without calling the storage API, which can improve the efficiency of stored data calls, improve the response rate of the applet, and reduce the communication between the applet and the client. unnecessary interaction and reduce the workload of interaction. Therefore, the storage of the applet in its own cache may also be referred to as near-end storage.
S104:校验所述小程序自身的缓存中是否保存有所述存储API调用请求所针对的存储数据。S104: Check whether the storage data targeted by the storage API call request is stored in the cache of the applet itself.
当小程序需要调用存储数据时,可先对小程序自身的缓存进行校验查询,确定其中是否保存有所需的存储数据,以确定是否需要调用客户端的存储API。其中,校验方式可通过存储数据的形式确定,比如根据存储数据的键值对进行匹配。When the applet needs to call the stored data, it can first check the cache of the applet itself to determine whether the required stored data is stored in it, so as to determine whether it is necessary to call the client's storage API. Wherein, the verification method can be determined by the form of the stored data, such as matching according to the key-value pairs of the stored data.
S106:若是,则为所述客户端过滤掉所述存储API调用请求,并根据所述小程序自身的缓存中的所述存储数据,实现所述存储API调用请求对应的存储相关操作。S106: If yes, filter out the storage API call request for the client, and implement a storage-related operation corresponding to the storage API call request according to the storage data in the cache of the applet itself.
若小程序自身的缓存中存在其所需的存储数据,则小程序可直接从自身的缓存中获取所需的存储数据,而无需再向客户端发送存储API调用请求。之后,小程序可根据自身的缓存中的存储数据,进行存储相关操作,包括存储写入操作、存储读取操作、存储更新操作、存储删除操作等。If the applet's own cache has the required storage data, the applet can directly obtain the required storage data from its own cache without sending a storage API call request to the client. Afterwards, the applet can perform storage-related operations according to the stored data in its own cache, including storage write operations, storage read operations, storage update operations, storage delete operations, and the like.
S108:否则,向所述客户端发起所述存储API调用请求。S108: Otherwise, initiate the storage API call request to the client.
若小程序自身的缓存中不存在其所需的存储数据,则小程序需要向客户端发起存储API调用请求,以从客户端的存储空间中获取所需的存储数据。If the required storage data does not exist in the mini-program's own cache, the mini-program needs to initiate a storage API call request to the client to obtain the required storage data from the client's storage space.
在本说明书一个或多个实施例中,小程序需要调用存储数据时,先对小程序自身的缓存进行校验,确定是否存在所需的数据。若存在则可直接调用,而无需向客户端请求调用。若不存在,再向客户端发起存储API调用请求。这样能够提高小程序存储数据调用的效率,特别针对存储数据的重复写入、读取等操作,减少小程序与客户端之间不必要的交互,从而减少额外的通信开销及小程序运行的性能开销,提高小程序运行的流畅性,改善小程序的运行卡顿。In one or more embodiments of this specification, when the applet needs to call the stored data, it first checks the cache of the applet itself to determine whether the required data exists. If it exists, it can be called directly without requesting the client to call it. If it does not exist, initiate a storage API call request to the client. This can improve the efficiency of small program storage data calls, especially for repeated writing and reading of stored data, and reduce unnecessary interaction between the small program and the client, thereby reducing additional communication overhead and small program running performance Overhead, improve the smoothness of the running of the applet, and improve the running of the applet.
基于图1的方法,本说明书还提供了该方法的一些具体实施方案和扩展方案,下面继续进行说明。Based on the method in FIG. 1 , this specification also provides some specific implementations and extensions of the method, which will be further described below.
在本说明书一个或多个实施例中,小程序在执行存储写入操作时,分别对小程序自身的缓存及客户端执行存储写入操作。一方面,对小程序自身的缓存执行存储写入操作,以将小程序对应的待写入数据,写入小程序自身的缓存中。另一方面,向客户端发起存储API调用请求,以使客户端通过也执行存储写入操作,将小程序对应的待写入数据在客户端对应的存储空间中持久化。In one or more embodiments of the present specification, when the applet executes the storage write operation, it respectively executes the storage write operation on the cache of the applet itself and the client. On the one hand, the store write operation is performed on the cache of the applet itself, so as to write the data to be written corresponding to the applet into the cache of the applet itself. On the other hand, a storage API call request is initiated to the client, so that the client also executes a storage write operation to persist the data to be written corresponding to the applet in the storage space corresponding to the client.
小程序自身的缓存与客户端的存储空间是相对独立的,客户端对应的存储空间不属于小程序,且不包括小程序自身的缓存。小程序自身的缓存中的存储数据为暂时性存储,其随小程序生命周期的终止而消失,客户端的存储空间中的存储数据为持久化存储,其不随小程序生命周期的变化而变化。The cache of the applet itself is relatively independent from the storage space of the client. The storage space corresponding to the client does not belong to the applet and does not include the cache of the applet itself. The stored data in the mini program's own cache is temporary storage, which disappears with the termination of the mini program's life cycle, and the stored data in the client's storage space is persistent storage, which does not change with the change of the mini program's life cycle.
通过将存储数据写入小程序自身的缓存,使小程序能直接从自身的缓存中调用存储数据,方便快捷,提高调用效率,而将存储数据也写入客户端的存储空间,能对存储数据进行持久化存储,便于小程序下一次生命周期启动时,能够保留相关存储记忆,为用户提供便利。By writing the stored data into the cache of the applet itself, the applet can directly call the stored data from its own cache, which is convenient and fast, and improves the efficiency of calling, and the stored data is also written into the storage space of the client, and the stored data can be processed. Persistent storage, so that when the next life cycle of the applet is started, the relevant storage memory can be retained to provide convenience for users.
进一步地,小程序在向客户端执行存储写入操作时,根据小程序对应的待写入数据,生成风险填充数据。根据风险填充数据,向客户端发起存储API调用请求,以使客户端先将风险填充数据在客户端对应的存储空间中持久化,以及在小程序的生命周期结束时,通过也执行存储写入操作,将客户端对应的存储空间中持久化的风险填充数据替换为小程序对应的待写入数据。Further, when the applet performs a storage write operation to the client, it generates risk filling data according to the data to be written corresponding to the applet. According to the risk filling data, initiate a storage API call request to the client, so that the client first persists the risk filling data in the corresponding storage space of the client, and at the end of the life cycle of the applet, also executes the storage write Operation, replace the persistent risk filling data in the storage space corresponding to the client with the data to be written corresponding to the applet.
风险填充数据表示与待写入数据相关、但隐藏了待写入数据中真实信息的数据。具体地,根据设定的对应关系,可对待写入数据进行拆分、转换、调序等,得到风险填充数据。风险填充数据可表现为与待写入数据完全无关的数据,也可表现为包含待写入数据中的非隐私部分的数据。The risk-filled data refers to the data that is related to the data to be written but hides the real information in the data to be written. Specifically, according to the set corresponding relationship, the data to be written can be split, converted, sequenced, etc. to obtain the risk filling data. The risk filling data can be represented as data completely irrelevant to the data to be written, or as data containing non-private parts of the data to be written.
在小程序的生命周期存续期间,客户端的存储空间中存储的是风险填充数据,即客户端无法知晓待写入数据中的真实信息,这样能够保障待写入数据的安全性,即使客户端存在数据泄露的风险,但待写入数据的真实信息也不会被泄露。而在小程序的生命周期结束时,再通过待写入数据对已存储的风险填充数据进行替换,保障了客户端能够对小程序产生的待写入数据进行存储。并且,这种存储方式可保证客户端的存储空间中存储的数据是小程序的生命周期内最新的存储数据,避免了客户端的存储空间中的存储数据未更新,与小程序需求的存储数据存在矛盾的问题。During the life cycle of the applet, the client's storage space stores risk-filled data, that is, the client cannot know the real information in the data to be written, which can ensure the security of the data to be written, even if the client exists. The risk of data leakage, but the real information of the data to be written will not be leaked. At the end of the life cycle of the applet, the stored risk filling data is replaced with the data to be written, which ensures that the client can store the data to be written generated by the applet. Moreover, this storage method can ensure that the data stored in the client's storage space is the latest stored data in the life cycle of the applet, avoiding the fact that the stored data in the client's storage space is not updated, and there is a contradiction with the stored data required by the applet The problem.
更进一步地,小程序在分别向自身的缓存及客户端执行存储写入操作时,相对于对小程序自身的缓存执行存储写入操作,向客户端异步发送存储API调用请求。并且,在对小程序自身的缓存执行存储写入操作之后,可立即从小程序自身的缓存读取通过存储写入操作所写入的数据。需要说明的是,以往小程序若直接针对客户端做这种写入(以往执行的是同步写入调用)后要立即读取刚才写入的数据,由于小程序调用客户端的存储API执行存储写入操作的时间较长,因此可能阻塞阻碍后续的读取操作,而在本方案则解决了这个问题。通过异步执行存储写入操作,可在将存储数据写入小程序自身的缓存后,立即对其进行读取,保障存储写入与读取的流畅性,提高小程序的响应效率。Furthermore, when the applet performs a storage write operation to its own cache and the client respectively, it sends a storage API call request to the client asynchronously compared to performing a storage write operation to the cache of the applet itself. Also, after the store write operation is performed on the applet's own cache, the data written by the store write operation can be read from the applet's own cache immediately. It should be noted that in the past, if the applet directly made this kind of write to the client (in the past, the synchronous write call was executed), the data just written should be read immediately, because the applet calls the storage API of the client to execute the storage write The input operation takes a long time, so it may block the subsequent read operation, but this problem is solved in this solution. By executing the storage write operation asynchronously, the stored data can be read immediately after the stored data is written into the Mini Program's own cache, ensuring the smoothness of storage writing and reading, and improving the response efficiency of the Mini Program.
如图2a所示,小程序在执行存储写入操作时,若先通过存储API向客户端的存储空间写入数据,会对后续的存储读取操作产生阻碍,使得小程序需要等待客户端完成存储写入操作后,才能对写入的存储数据进行读取,这样阻塞了正常的业务流程,延长了用户的操作等待时间。As shown in Figure 2a, when the applet performs storage write operations, if it first writes data to the client’s storage space through the storage API, it will hinder subsequent storage read operations, making the applet need to wait for the client to complete the storage. The written storage data can only be read after the write operation, which blocks the normal business process and prolongs the waiting time for the user's operation.
如图2b所示,小程序在执行存储写入操作时,先将待写入数据写入小程序自身的缓存(即近端缓存)中。由于近端缓存的写入时间较短、较快速,后续可立即对写入的存储数据进行读取操作。之后,再异步将待写入数据写入客户端的存储空间中,也不会对存储读取操作产生影响。As shown in FIG. 2 b , when the applet performs a storage write operation, it first writes the data to be written into the cache of the applet itself (ie, the near-end cache). Since the writing time of the near-end cache is short and fast, the written storage data can be read immediately afterwards. Afterwards, asynchronously writing the data to be written into the storage space of the client will not affect the storage read operation.
在本说明书一个或多个实施例中,小程序在执行存储读取操作时,经过对小程序自身缓存的校验,可直接从小程序自身的缓存中读取存储数据,并返回给小程序。这样能 够避免读取数据时对客户端存储API的重复调用,节省小程序的性能开销,提高小程序的数据调用效率。In one or more embodiments of this specification, when the applet performs a storage read operation, after verifying the applet's own cache, it can directly read the stored data from the applet's own cache and return it to the applet. This can avoid repeated calls to the client storage API when reading data, save the performance overhead of the applet, and improve the data call efficiency of the applet.
进一步地,校验小程序自身的缓存中是否保存有存储API调用请求所针对的存储数据之前,还可根据存储缓存管理器的基类,为小程序自身的缓存生成小程序缓存管理对象,以便通过小程序缓存管理对象的实例,访问小程序自身的缓存,以及执行校验。Furthermore, before verifying whether the storage data targeted by the storage API call request is stored in the cache of the applet itself, an applet cache management object can also be generated for the cache of the applet itself according to the base class of the storage cache manager, so that Use the applet to cache the instance of the management object, access the cache of the applet itself, and perform verification.
更进一步地,根据存储缓存管理器的基类,还可为应用的插件的缓存生成插件缓存管理对象,其中,客户端属于该应用或者另一应用。根据存储API调用请求和/或指定的应用标识,在小程序缓存管理对象和插件缓存管理对象中选择目标对象,以确定通过小程序或插件发起存储API调用请求。与小程序缓存管理对象类似,通过插件缓存管理对象可以管理为插件自身分配的缓存,进而将插件的数据在该缓存中暂时存储以及访问使用,从而可以减少插件对其所在客户端或者其他应用的打扰。Furthermore, according to the base class of the storage cache manager, a plug-in cache management object can also be generated for the cache of the plug-in of the application, wherein the client belongs to the application or another application. According to the storage API call request and/or the specified application identifier, select the target object from the applet cache management object and the plug-in cache management object, so as to determine that the storage API call request is initiated through the applet or the plug-in. Similar to the applet cache management object, the plug-in cache management object can manage the cache allocated for the plug-in itself, and then temporarily store and access the data of the plug-in in the cache, thereby reducing the plug-in's impact on its client or other applications. disturb.
在本说明书一个或多个实施例中,若小程序发起的存储API调用请求对应的存储相关操作不是存储抹消操作,则经过在小程序自身的缓存中的校验,可为客户端过滤掉该存储API调用请求。若存储相关操作为存储抹消操作,则清除小程序自身的缓存中的存储数据,并向客户端发起存储API调用请求,以使客户端在缓存之外持久化的小程序相关的存储数据也被清除。In one or more embodiments of this specification, if the storage-related operation corresponding to the storage API call request initiated by the applet is not a storage erase operation, the client can filter out the operation after verification in the cache of the applet itself. Store API call requests. If the storage-related operation is a storage erase operation, clear the stored data in the cache of the applet itself, and initiate a storage API call request to the client, so that the stored data related to the applet persisted by the client outside the cache is also deleted. clear.
进一步地,小程序自身的缓存运行于小程序的生命周期中,当小程序的生命周期结束时,销毁小程序自身的缓存,从而小程序自身的缓存内的存储数据丢失。但客户端的存储空间的存储数据不受小程序生命周期结束的影响,以便于小程序的下次生命周期开始时,可继续调用存储数据。由于小程序的近端缓存只存在于小程序的生命周期中,因此,在小程序的生命周期结束时对近端缓存数据进行销毁,也不会存在缓存数据的持久性问题与新旧缓存数据不同的矛盾问题。Furthermore, the cache of the applet itself runs in the life cycle of the applet, and when the life cycle of the applet ends, the cache of the applet itself is destroyed, so that the stored data in the cache of the applet itself is lost. However, the stored data in the client's storage space is not affected by the end of the applet's life cycle, so that the stored data can continue to be called when the next life cycle of the applet starts. Since the near-end cache of the applet only exists in the life cycle of the applet, if the near-end cache data is destroyed at the end of the life cycle of the applet, there will be no persistence problem of the cache data, which is different from the old and new cache data. contradiction problem.
更进一步地,存储数据包括键值对中的键。小程序执行的存储相关操作为存储读取操作时,若客户端响应于存储API调用请求,在执行存储读取操作时,对键的值读取失败,表示存储数据中不存在该键对应的值,则将该键确定为错误键并进行记录,以过滤掉用于读取该错误键的值的存储API调用请求,避免后续重复执行对该错误键的存储读取操作。之后,在通过执行存储写入操作为该错误键写入值后,表示该错误键已在存储数据中存在与之对应的值,则可确定该键不再为错误键,并对记录进行修改。Furthermore, stored data includes keys in key-value pairs. When the storage-related operation performed by the applet is a storage read operation, if the client responds to the storage API call request and executes the storage read operation, it fails to read the value of the key, indicating that the storage data does not exist corresponding to the key. value, the key is determined to be an incorrect key and recorded, so as to filter out storage API call requests for reading the value of the incorrect key, and avoid subsequent repeated execution of storage read operations on the incorrect key. Afterwards, after writing a value for the wrong key by performing a storage write operation, indicating that the wrong key already has a corresponding value in the stored data, it can be determined that the key is no longer a wrong key, and the record can be modified .
如图3所示,小程序在执行存储读取操作时,根据读取失败的结果对错误键进行记录,形成错误键数组的存储数据。后续小程序在执行存储写入操作,对错误键进行修正后,可将错误键数组中记录的该错误键消除。As shown in Figure 3, when the applet performs a storage read operation, it records the error key according to the result of the read failure to form the storage data of the error key array. After the subsequent applet executes the storage write operation and corrects the wrong key, it can delete the wrong key recorded in the wrong key array.
结合前面的说明,本说明书一个或多个实施例提供了一种应用场景下,图1中方法的一种详细流程示意图,该流程中使用了前面一些可选的方案,该流程如图4所示。In combination with the previous description, one or more embodiments of this specification provide a detailed flow diagram of the method in Figure 1 in an application scenario, in which some of the previous optional solutions are used, and the process is shown in Figure 4 Show.
在图4的流程中,针对存储写入操作,小程序进行存储API的首次调用时,根据待写入数据对应的键值对(Key-Value,KV),在小程序自身的缓存中进行校验,确定是否存在相同的键值对。一般首次调用时,会无法命中相同KV,则小程序需要将待写入数据对应的键值对写入小程序自身的缓存,也写入客户端的存储空间。比如,可以通过JSAPI CALL BRIDGE与客户端进行通讯,以便进行存储API的调用。In the process of Figure 4, for the storage write operation, when the applet calls the storage API for the first time, it checks in the cache of the applet itself according to the key-value pair (Key-Value, KV) corresponding to the data to be written. test to determine if the same key-value pair exists. Generally, when calling for the first time, the same KV cannot be hit, so the applet needs to write the key-value pair corresponding to the data to be written into the cache of the applet itself, and also into the storage space of the client. For example, you can communicate with the client through JSAPI CALL BRIDGE to call the storage API.
小程序进行存储API的再次调用时,根据待写入数据在小程序自身的缓存中进行校验,确定是否存在相同的键值对KV。若存在相同的键值对,表示小程序已将待写入数据写入小程序自身的缓存,小程序不是对待写入数据不是首次调用,则可直接返回在小程序自身的缓存中的校验结果。若不存在相同的键值对,表示小程序未在自身的缓存中存储过该数据,即也未在客户端的存储空间中存储过该数据,则将待写入数据写入小程序自身的缓存及客户端的存储空间中。When the applet calls the storage API again, it checks in the cache of the applet itself according to the data to be written to determine whether the same key-value pair KV exists. If there is the same key-value pair, it means that the applet has written the data to be written into the cache of the applet itself. If the applet is not treating the data to be written or it is the first call, it can directly return the verification in the cache of the applet itself. result. If the same key-value pair does not exist, it means that the applet has not stored the data in its own cache, that is, the data has not been stored in the client's storage space, then write the data to be written into the cache of the applet itself and in the storage space of the client.
针对存储读取操作,根据需要读取的数据的键,在小程序自身的缓存中校验是否存在对应的值。若存在与待读取的键对应的值,可直接将对应值返回给小程序。若不存在与待读取的键对应的值,再调用客户端的存储API,在客户端的存储空间中查询对应的值。For the storage read operation, according to the key of the data to be read, check whether there is a corresponding value in the cache of the applet itself. If there is a value corresponding to the key to be read, the corresponding value can be directly returned to the applet. If there is no value corresponding to the key to be read, then call the storage API of the client to query the corresponding value in the storage space of the client.
针对存储抹消操作,需要清除小程序自身的缓存中的存储数据,并将客户端的存储空间中的存储数据一并清除。For the storage erasing operation, it is necessary to clear the stored data in the cache of the applet itself, and also clear the stored data in the client's storage space.
基于同样的思路,本说明书一个或多个实施例还提供了上述方法对应的装置和设备,如图5、图6所示。Based on the same idea, one or more embodiments of this specification also provide devices and devices corresponding to the above method, as shown in FIG. 5 and FIG. 6 .
图5为本说明书一个或多个实施例提供的一种小程序存储调用装置的结构示意图,所述小程序运行于客户端上,所述装置包括:访问模块502,在所述小程序要向所述客户端发起存储API调用请求之前,访问所述小程序自身的缓存;校验模块504,校验所述小程序自身的缓存中是否保存有所述存储API调用请求所针对的存储数据;实现模块506,在所述校验模块504的结果为是的情况下,为所述客户端过滤掉所述存储API调用请求,并根据所述小程序自身的缓存中的所述存储数据,实现所述存储API调用请求对应的存储相关操作;发起模块508,在所述校验模块504的结果为否的情况下,向所述客户端发起所述存储API调用请求。Fig. 5 is a schematic structural diagram of a device for storing and invoking a small program provided by one or more embodiments of this specification. The small program runs on the client, and the device includes: an access module 502. Before the client initiates a storage API call request, it accesses the cache of the applet itself; the verification module 504 checks whether the storage data targeted by the storage API call request is stored in the cache of the applet itself; The realization module 506, when the result of the verification module 504 is yes, filters out the storage API call request for the client, and realizes The storage-related operation corresponding to the storage API call request; the initiating module 508, when the result of the verification module 504 is negative, initiates the storage API call request to the client.
可选地,所述存储相关操作为存储写入操作;所述发起模块508,对所述小程序自身的缓存执行所述存储写入操作,以将所述小程序对应的待写入数据,写入所述小程序自身的缓存中;向所述客户端发起所述存储API调用请求,以使所述客户端通过也执行所述存储写入操作,将所述小程序对应的待写入数据在所述客户端对应的存储空间中持久化,所述客户端对应的存储空间不属于所述小程序,且不包括所述小程序自身的缓存。Optionally, the storage-related operation is a storage write operation; the initiating module 508 executes the storage write operation on the cache of the applet itself, so as to write the data to be written corresponding to the applet, Write in the cache of the applet itself; initiate the storage API call request to the client, so that the client also executes the storage write operation, and writes the to-be-written data corresponding to the applet The data is persisted in the storage space corresponding to the client, and the storage space corresponding to the client does not belong to the applet and does not include the cache of the applet itself.
可选地,所述发起模块508,根据所述小程序对应的待写入数据,生成风险填充数据;根据所述风险填充数据,向所述客户端发起所述存储API调用请求,以使所述客户 端先将所述风险填充数据在所述客户端对应的存储空间中持久化,以及在所述小程序的生命周期结束时,通过也执行所述存储写入操作,将所述客户端对应的存储空间中持久化的所述风险填充数据替换为所述小程序对应的待写入数据。Optionally, the initiating module 508 generates risk filling data according to the data to be written corresponding to the applet; according to the risk filling data, initiates the storage API call request to the client, so that all The client first persists the risk filling data in the storage space corresponding to the client, and at the end of the life cycle of the applet, by also executing the storage write operation, the client The risk filling data persisted in the corresponding storage space is replaced with the data to be written corresponding to the applet.
可选地,所述发起模块508,相对于对所述小程序自身的缓存执行所述存储写入操作,向所述客户端异步发送所述存储API调用请求;所述装置还包括立即读取模块510,所述立即读取模块510在所述发起模块508对所述小程序自身的缓存执行所述存储写入操作之后,执行:立即从所述小程序自身的缓存读取通过所述存储写入操作所写入的数据。Optionally, the initiating module 508, relative to executing the storage write operation on the cache of the applet itself, sends the storage API call request to the client asynchronously; the device also includes immediate reading module 510, the immediate read module 510, after the initiating module 508 executes the storage write operation on the cache of the applet itself, executes: immediately read from the cache of the applet itself through the storage The data written by the write operation.
可选地,所述存储相关操作为存储读取操作;所述实现模块506,从所述小程序自身的缓存中读取所述存储数据,并返回给所述小程序。Optionally, the storage-related operation is a storage read operation; the realization module 506 reads the stored data from the cache of the applet itself, and returns it to the applet.
所述装置还可包括生成模块512,所述生成模块512在所述校验模块504校验所述小程序自身的缓存中是否保存有所述存储API调用请求所针对的存储数据之前,执行:根据存储缓存管理器的基类,为所述小程序自身的缓存生成小程序缓存管理对象,以便通过所述小程序缓存管理对象的实例,访问所述小程序自身的缓存,以及执行所述校验。The device may further include a generation module 512, and before the verification module 504 verifies whether the storage data targeted by the storage API call request is stored in the cache of the applet itself, execute: According to the base class of the storage cache manager, an applet cache management object is generated for the cache of the applet itself, so that the cache of the applet itself can be accessed through the instance of the applet cache management object, and the calibration can be executed. test.
可选地,所述装置还包括选择模块514,所述选择模块514在所述校验模块504校验所述小程序自身的缓存中是否保存有所述存储API调用请求所针对的存储数据之前,执行:根据存储缓存管理器的基类,为应用的插件的缓存生成插件缓存管理对象,其中,所述客户端属于所述应用或者另一应用;根据所述存储API调用请求和/或指定的应用标识,在所述小程序缓存管理对象和所述插件缓存管理对象中选择目标对象。Optionally, the device further includes a selection module 514, before the verification module 504 verifies whether the storage data targeted by the storage API call request is saved in the cache of the applet itself , execute: generate a plug-in cache management object for the plug-in cache of the application according to the base class of the storage cache manager, wherein the client belongs to the application or another application; call the request and/or specify according to the storage API The application identifier of the application, and select a target object from the applet cache management object and the plug-in cache management object.
所述装置还可包括确定模块516,所述确定模块516在所述实现模块506为所述客户端过滤掉所述存储API调用请求之前,执行:确定所述存储相关操作不为存储抹消操作;所述装置还包括清除模块518,所述清除模块518执行:若所述存储相关操作为存储抹消操作,清除所述小程序自身的缓存中的所述存储数据;向所述客户端发起所述存储API调用请求,以使所述客户端在所述缓存之外持久化的所述存储数据也被清除。The apparatus may further include a determination module 516, and before the implementation module 506 filters out the storage API call request for the client, the determination module 516: determines that the storage-related operation is not a storage erasure operation; The device also includes a clearing module 518, and the clearing module 518 executes: if the storage-related operation is a storage erase operation, clear the stored data in the cache of the applet itself; storing the API call request, so that the stored data persisted by the client outside the cache is also cleared.
可选地,所述存储数据包括键值对中的键,所述存储相关操作为存储读取操作;所述装置还包括错误记录模块520,所述错误记录模块520在所述发起模块508向所述客户端发起所述存储API调用请求之后,执行:若所述客户端响应于所述存储API调用请求,在执行所述存储读取操作时,对所述键的值读取失败,则将所述键确定为错误键并进行记录,以过滤掉用于读取所述错误键的值的存储API调用请求;在通过执行存储写入操作,为所述键写入值后,确定所述键不再为错误键。Optionally, the stored data includes a key in a key-value pair, and the storage-related operation is a storage read operation; the device further includes an error recording module 520, and the error recording module 520 sends an error message to the initiating module 508 After the client initiates the storage API call request, execute: if the client fails to read the value of the key when executing the storage read operation in response to the storage API call request, then Determining the key as an error key and recording it to filter out storage API call requests for reading the value of the error key; after writing a value for the key by performing a storage write operation, determining the The above key is no longer an error key.
可选地,所述小程序自身的缓存运行于所述小程序的生命周期中,所述装置还包括销毁模块522,所述销毁模块522执行:当所述小程序的生命周期结束时,销毁所述小程序自身的缓存,从而所述小程序自身的缓存内的存储数据丢失。Optionally, the cache of the applet itself runs in the life cycle of the applet, and the device further includes a destroying module 522, and the destroying module 522 executes: when the life cycle of the applet ends, destroy The applet's own cache, and thus the stored data in the applet's own cache, is lost.
图6为本说明书一个或多个实施例提供的一种小程序存储调用设备的结构示意图,所述小程序运行于客户端上,所述设备包括:至少一个处理器;以及,与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够:在所述小程序要向所述客户端发起存储API调用请求之前,访问所述小程序自身的缓存;校验所述小程序自身的缓存中是否保存有所述存储API调用请求所针对的存储数据;若是,则为所述客户端过滤掉所述存储API调用请求,并根据所述小程序自身的缓存中的所述存储数据,实现所述存储API调用请求对应的存储相关操作;否则,向所述客户端发起所述存储API调用请求。Fig. 6 is a schematic structural diagram of a device for storing and invoking a small program provided by one or more embodiments of this specification. The small program runs on a client, and the device includes: at least one processor; A memory communicatively connected to a processor; wherein the memory stores instructions executable by the at least one processor, the instructions are executed by the at least one processor, so that the at least one processor can: Before the applet initiates a storage API call request to the client, access the cache of the applet itself; check whether the storage data targeted by the storage API call request is saved in the cache of the applet itself ; If so, filter out the storage API call request for the client, and implement the storage-related operations corresponding to the storage API call request according to the storage data in the cache of the applet itself; otherwise, send The client initiates the storage API calling request.
基于同样的思路,本说明书一个或多个实施例还提供了对应于上述方法的一种非易失性计算机存储介质,存储有计算机可执行指令,所述计算机可执行指令设置为:在所述小程序要向所述客户端发起存储API调用请求之前,访问所述小程序自身的缓存;校验所述小程序自身的缓存中是否保存有所述存储API调用请求所针对的存储数据;若是,则为所述客户端过滤掉所述存储API调用请求,并根据所述小程序自身的缓存中的所述存储数据,实现所述存储API调用请求对应的存储相关操作;否则,向所述客户端发起所述存储API调用请求。Based on the same idea, one or more embodiments of this specification also provide a non-volatile computer storage medium corresponding to the above method, which stores computer-executable instructions, and the computer-executable instructions are configured to: Before the applet initiates a storage API call request to the client, access the cache of the applet itself; check whether the storage data targeted by the storage API call request is saved in the cache of the applet itself; if , then filter out the storage API call request for the client, and implement the storage-related operations corresponding to the storage API call request according to the storage data in the cache of the applet itself; otherwise, send the The client initiates the storage API call request.
在20世纪90年代,对于一个技术的改进可以很明显地区分是硬件上的改进(例如,对二极管、晶体管、开关等电路结构的改进)还是软件上的改进(对于方法流程的改进)。然而,随着技术的发展,当今的很多方法流程的改进已经可以视为硬件电路结构的直接改进。设计人员几乎都通过将改进的方法流程编程到硬件电路中来得到相应的硬件电路结构。因此,不能说一个方法流程的改进就不能用硬件实体模块来实现。例如,可编程逻辑器件(Programmable Logic Device,PLD)(例如现场可编程门阵列(Field Programmable Gate Array,FPGA))就是这样一种集成电路,其逻辑功能由用户对器件编程来确定。由设计人员自行编程来把一个数字系统“集成”在一片PLD上,而不需要请芯片制造厂商来设计和制作专用的集成电路芯片。而且,如今,取代手工地制作集成电路芯片,这种编程也多半改用“逻辑编译器(logic compiler)”软件来实现,它与程序开发撰写时所用的软件编译器相类似,而要编译之前的原始代码也得用特定的编程语言来撰写,此称之为硬件描述语言(Hardware Description Language,HDL),而HDL也并非仅有一种,而是有许多种,如ABEL(Advanced Boolean Expression Language)、AHDL(Altera Hardware Description Language)、Confluence、CUPL(Cornell University Programming Language)、HDCal、JHDL(Java Hardware Description Language)、Lava、Lola、MyHDL、PALASM、RHDL(Ruby Hardware Description Language)等,目前最普遍使用的是VHDL(Very-High-Speed Integrated Circuit Hardware Description Language)与Verilog。本领域技术人员也应该清楚,只需要将方法流程用上述几种硬件描述语言稍作逻辑编程并编程到集成电路中,就可以很容易得到实现该逻辑方法流程的硬件电路。In the 1990s, the improvement of a technology can be clearly distinguished as an improvement in hardware (for example, improvements in circuit structures such as diodes, transistors, and switches) or improvements in software (improvement in method flow). However, with the development of technology, the improvement of many current method flows can be regarded as the direct improvement of the hardware circuit structure. Designers almost always get the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow cannot be realized by hardware physical modules. For example, a programmable logic device (Programmable Logic Device, PLD) (such as a field programmable gate array (Field Programmable Gate Array, FPGA)) is such an integrated circuit, the logic function of which is determined by the user's programming of the device. It is programmed by the designer to "integrate" a digital system on a PLD, instead of asking a chip manufacturer to design and make a dedicated integrated circuit chip. Moreover, nowadays, instead of making integrated circuit chips by hand, this kind of programming is mostly realized by "logic compiler (logic compiler)" software, which is similar to the software compiler used when program development and writing, but before compiling The original code of the computer must also be written in a specific programming language, which is called a hardware description language (Hardware Description Language, HDL), and there is not only one kind of HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language) , AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc., are currently the most commonly used The most popular are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. It should also be clear to those skilled in the art that only a little logical programming of the method flow in the above-mentioned hardware description languages and programming into an integrated circuit can easily obtain a hardware circuit for realizing the logic method flow.
控制器可以按任何适当的方式实现,例如,控制器可以采取例如微处理器或处理器以及存储可由该(微)处理器执行的计算机可读程序代码(例如软件或固件)的计算机可读介质、逻辑门、开关、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程逻辑控制器和嵌入微控制器的形式,控制器的例子包括但不限于以下微控制器:ARC 625D、Atmel AT91SAM、Microchip PIC18F26K20以及Silicone Labs C8051F320,存储器控制器还可以被实现为存储器的控制逻辑的一部分。本领域技术人员也知道,除了以纯计算机可读程序代码方式实现控制器以外,完全可以通过将方法步骤进行逻辑编程来使得控制器以逻辑门、开关、专用集成电路、可编程逻辑控制器和嵌入微控制器等的形式来实现相同功能。因此这种控制器可以被认为是一种硬件部件,而对其内包括的用于实现各种功能的装置也可以视为硬件部件内的结构。或者甚至,可以将用于实现各种功能的装置视为既可以是实现方法的软件模块又可以是硬件部件内的结构。The controller may be implemented in any suitable way, for example the controller may take the form of a microprocessor or processor and a computer readable medium storing computer readable program code (such as software or firmware) executable by the (micro)processor , logic gates, switches, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable logic controllers and embedded microcontrollers, examples of controllers include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20 and Silicone Labs C8051F320, the memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that, in addition to realizing the controller in a purely computer-readable program code mode, it is entirely possible to make the controller use logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded The same function can be realized in the form of a microcontroller or the like. Therefore, such a controller can be regarded as a hardware component, and the devices included in it for realizing various functions can also be regarded as structures within the hardware component. Or even, means for realizing various functions can be regarded as a structure within both a software module realizing a method and a hardware component.
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机。具体的,计算机例如可以为个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任何设备的组合。The systems, devices, modules, or units described in the above embodiments can be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementing device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or Combinations of any of these devices.
为了描述的方便,描述以上装置时以功能分为各种单元分别描述。当然,在实施本说明书时可以把各单元的功能在同一个或多个软件和/或硬件中实现。For the convenience of description, when describing the above devices, functions are divided into various units and described separately. Of course, when implementing this specification, the functions of each unit can be implemented in one or more pieces of software and/or hardware.
本领域内的技术人员应明白,本说明书实施例可提供为方法、系统、或计算机程序产品。因此,本说明书实施例可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本说明书实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of this specification may be provided as methods, systems, or computer program products. Accordingly, the embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present description may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
本说明书是参照根据本说明书实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The specification is described with reference to flowcharts and/or block diagrams of methods, devices (systems), and computer program products according to embodiments of the specification. It should be understood that each procedure and/or block in the flowchart and/or block diagram, and a combination of procedures and/or blocks in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions may be provided to a general purpose computer, special purpose computer, embedded processor, or processor of other programmable data processing equipment to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing equipment produce a An apparatus for realizing the functions specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions The device realizes the function specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby The instructions provide steps for implementing the functions specified in the flow chart or blocks of the flowchart and/or the block or blocks of the block diagrams.
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。Memory may include non-permanent storage in computer readable media, in the form of random access memory (RAM) and/or nonvolatile memory such as read-only memory (ROM) or flash RAM. Memory is an example of computer readable media.
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。Computer-readable media, including both permanent and non-permanent, removable and non-removable media, can be implemented by any method or technology for storage of information. Information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Flash memory or other memory technology, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic tape cartridge, tape magnetic disk storage or other magnetic storage device or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media excludes transitory computer-readable media, such as modulated data signals and carrier waves.
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。It should also be noted that the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes Other elements not expressly listed, or elements inherent in the process, method, commodity, or apparatus are also included. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.
本说明书可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本说明书,在这些分布式计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。The specification may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The present description may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including storage devices.
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于装置、设备、非易失性计算机存储介质实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。Each embodiment in this specification is described in a progressive manner, the same and similar parts of each embodiment can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the apparatus, equipment, and non-volatile computer storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and for relevant parts, please refer to the part of the description of the method embodiments.
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执 行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。The foregoing describes specific embodiments of this specification. Other implementations are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that 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. Multitasking and parallel processing are also possible or may be advantageous in certain embodiments.
以上所述仅为本说明书的一个或多个实施例而已,并不用于限制本说明书。对于本领域技术人员来说,本说明书的一个或多个实施例可以有各种更改和变化。凡在本说明书的一个或多个实施例的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在本说明书的权利要求范围之内。The above description is only one or more embodiments of this specification, and is not intended to limit this specification. Various modifications and changes will occur to one or more embodiments of this description for those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of one or more embodiments of this specification shall be included within the scope of claims of this specification.

Claims (21)

  1. 一种小程序存储调用方法,所述小程序运行于客户端上,所述方法包括:A method for storing and invoking an applet, the applet is run on a client, and the method includes:
    在所述小程序要向所述客户端发起存储API调用请求之前,访问所述小程序自身的缓存;Before the applet initiates a storage API call request to the client, access the cache of the applet itself;
    校验所述小程序自身的缓存中是否保存有所述存储API调用请求所针对的存储数据;Verifying whether the storage data targeted by the storage API call request is stored in the cache of the applet itself;
    若是,则为所述客户端过滤掉所述存储API调用请求,并根据所述小程序自身的缓存中的所述存储数据,实现所述存储API调用请求对应的存储相关操作;If so, filter out the storage API call request for the client, and implement storage-related operations corresponding to the storage API call request according to the storage data in the cache of the applet itself;
    否则,向所述客户端发起所述存储API调用请求。Otherwise, initiate the storage API call request to the client.
  2. 如权利要求1所述的方法,所述存储相关操作为存储写入操作;The method according to claim 1, wherein the storage-related operation is a storage write operation;
    所述向所述客户端发起所述存储API调用请求,具体包括:The initiating the storage API call request to the client specifically includes:
    对所述小程序自身的缓存执行所述存储写入操作,以将所述小程序对应的待写入数据,写入所述小程序自身的缓存中;Executing the storage write operation on the cache of the applet itself, so as to write the data to be written corresponding to the applet into the cache of the applet itself;
    向所述客户端发起所述存储API调用请求,以使所述客户端通过也执行所述存储写入操作,将所述小程序对应的待写入数据在所述客户端对应的存储空间中持久化,所述客户端对应的存储空间不属于所述小程序,且不包括所述小程序自身的缓存。Initiate the storage API call request to the client, so that the client also executes the storage write operation to store the data to be written corresponding to the applet in the storage space corresponding to the client For persistence, the storage space corresponding to the client does not belong to the applet, and does not include the cache of the applet itself.
  3. 如权利要求2所述的方法,所述向所述客户端发起所述存储API调用请求,以使所述客户端通过也执行所述存储写入操作,将所述小程序对应的待写入数据在所述客户端对应的存储空间中持久化,具体包括:The method according to claim 2, wherein the initiating the storage API call request to the client, so that the client also executes the storage write operation, and writes the to-be-written data corresponding to the applet The data is persisted in the storage space corresponding to the client, specifically including:
    根据所述小程序对应的待写入数据,生成风险填充数据;Generate risk filling data according to the data to be written corresponding to the applet;
    根据所述风险填充数据,向所述客户端发起所述存储API调用请求,以使所述客户端先将所述风险填充数据在所述客户端对应的存储空间中持久化,以及在所述小程序的生命周期结束时,通过也执行所述存储写入操作,将所述客户端对应的存储空间中持久化的所述风险填充数据替换为所述小程序对应的待写入数据。According to the risk filling data, initiate the storage API call request to the client, so that the client first persists the risk filling data in the storage space corresponding to the client, and in the When the life cycle of the applet ends, the risk filling data persisted in the storage space corresponding to the client is replaced with the data to be written corresponding to the applet by also performing the storage write operation.
  4. 如权利要求2所述的方法,所述向所述客户端发起所述存储API调用请求,具体包括:The method according to claim 2, said initiating said storage API call request to said client, specifically comprising:
    相对于对所述小程序自身的缓存执行所述存储写入操作,向所述客户端异步发送所述存储API调用请求;Relative to performing the storage write operation on the cache of the applet itself, asynchronously send the storage API call request to the client;
    所述对所述小程序自身的缓存执行所述存储写入操作之后,所述方法还包括:After the storage write operation is performed on the cache of the applet itself, the method further includes:
    立即从所述小程序自身的缓存读取通过所述存储写入操作所写入的数据。The data written by the storage write operation is immediately read from the applet's own cache.
  5. 如权利要求1所述的方法,所述存储相关操作为存储读取操作;The method according to claim 1, wherein the storage-related operation is a storage read operation;
    所述根据所述小程序自身的缓存中的所述存储数据,实现所述存储API调用请求对应的存储相关操作,具体包括:According to the stored data in the cache of the applet itself, implementing the storage-related operations corresponding to the storage API call request specifically includes:
    从所述小程序自身的缓存中读取所述存储数据,并返回给所述小程序。The stored data is read from the cache of the applet itself, and returned to the applet.
  6. 如权利要求1所述的方法,所述校验所述小程序自身的缓存中是否保存有所述存储API调用请求所针对的存储数据之前,所述方法还包括:The method according to claim 1, before verifying whether the storage data targeted by the storage API call request is stored in the cache of the applet itself, the method further comprises:
    根据存储缓存管理器的基类,为所述小程序自身的缓存生成小程序缓存管理对象,以便通过所述小程序缓存管理对象的实例,访问所述小程序自身的缓存,以及执行所述校验。According to the base class of the storage cache manager, an applet cache management object is generated for the cache of the applet itself, so that the cache of the applet itself can be accessed through the instance of the applet cache management object, and the calibration can be executed. test.
  7. 如权利要求6所述的方法,所述校验所述小程序自身的缓存中是否保存有所述存储API调用请求所针对的存储数据之前,所述方法还包括:The method according to claim 6, before verifying whether the storage data targeted by the storage API call request is stored in the cache of the applet itself, the method further comprises:
    根据存储缓存管理器的基类,为应用的插件的缓存生成插件缓存管理对象,其中,所述客户端属于所述应用或者另一应用;Generate a plug-in cache management object for the cache of the plug-in of the application according to the base class of the storage cache manager, wherein the client belongs to the application or another application;
    根据所述存储API调用请求和/或指定的应用标识,在所述小程序缓存管理对象和所述插件缓存管理对象中选择目标对象。Select a target object from the applet cache management object and the plug-in cache management object according to the storage API call request and/or the specified application identifier.
  8. 如权利要求1所述的方法,所述为所述客户端过滤掉所述存储API调用请求之前,所述方法还包括:The method according to claim 1, before filtering out the storage API call request for the client, the method further comprises:
    确定所述存储相关操作不为存储抹消操作;Determining that the storage-related operation is not a storage erasure operation;
    若所述存储相关操作为存储抹消操作,所述方法还包括:If the storage-related operation is a storage erasure operation, the method further includes:
    清除所述小程序自身的缓存中的所述存储数据;clearing the stored data in the cache of the applet itself;
    向所述客户端发起所述存储API调用请求,以使所述客户端在所述缓存之外持久化的所述存储数据也被清除。Initiating the storage API call request to the client, so that the storage data persisted by the client outside the cache is also cleared.
  9. 如权利要求1所述的方法,所述存储数据包括键值对中的键,所述存储相关操作为存储读取操作;The method according to claim 1, wherein the stored data comprises a key in a key-value pair, and the storage-related operation is a storage read operation;
    所述向所述客户端发起所述存储API调用请求之后,所述方法还包括:After initiating the storage API call request to the client, the method further includes:
    若所述客户端响应于所述存储API调用请求,在执行所述存储读取操作时,对所述键的值读取失败,则将所述键确定为错误键并进行记录,以过滤掉用于读取所述错误键的值的存储API调用请求;If the client fails to read the value of the key when performing the storage read operation in response to the storage API call request, then determine the key as an error key and record it to filter out a Storage API call request to read the value of said erroneous key;
    在通过执行存储写入操作,为所述键写入值后,确定所述键不再为错误键。After writing a value for the key by performing a store write operation, it is determined that the key is no longer an erroneous key.
  10. 如权利要求1至9任一项所述的方法,所述小程序自身的缓存运行于所述小程序的生命周期中,所述方法还包括:The method according to any one of claims 1 to 9, wherein the cache of the applet itself runs in the lifecycle of the applet, the method further comprising:
    当所述小程序的生命周期结束时,销毁所述小程序自身的缓存,从而所述小程序自身的缓存内的存储数据丢失。When the life cycle of the applet ends, the cache of the applet itself is destroyed, so that the stored data in the cache of the applet itself is lost.
  11. 一种小程序存储调用装置,所述小程序运行于客户端上,所述装置包括:A device for storing and invoking a small program, the small program runs on a client, and the device includes:
    访问模块,在所述小程序要向所述客户端发起存储API调用请求之前,访问所述小程序自身的缓存;An access module, before the applet initiates a storage API call request to the client, accesses the cache of the applet itself;
    校验模块,校验所述小程序自身的缓存中是否保存有所述存储API调用请求所针对的存储数据;A verification module, which verifies whether the storage data targeted by the storage API call request is stored in the cache of the applet itself;
    实现模块,在所述校验模块的结果为是的情况下,为所述客户端过滤掉所述存储API调用请求,并根据所述小程序自身的缓存中的所述存储数据,实现所述存储API调用请求对应的存储相关操作;An implementation module, if the result of the verification module is yes, filter out the storage API call request for the client, and implement the storage according to the storage data in the cache of the applet itself Storage-related operations corresponding to the storage API call request;
    发起模块,在所述校验模块的结果为否的情况下,向所述客户端发起所述存储API 调用请求。An initiating module, in the case that the result of the checking module is negative, initiating the storage API calling request to the client.
  12. 如权利要求11所述的装置,所述存储相关操作为存储写入操作;The apparatus according to claim 11, wherein the storage-related operation is a storage write operation;
    所述发起模块,对所述小程序自身的缓存执行所述存储写入操作,以将所述小程序对应的待写入数据,写入所述小程序自身的缓存中;The initiating module executes the storage write operation on the cache of the applet itself, so as to write the data to be written corresponding to the applet into the cache of the applet itself;
    向所述客户端发起所述存储API调用请求,以使所述客户端通过也执行所述存储写入操作,将所述小程序对应的待写入数据在所述客户端对应的存储空间中持久化,所述客户端对应的存储空间不属于所述小程序,且不包括所述小程序自身的缓存。Initiate the storage API call request to the client, so that the client also executes the storage write operation to store the data to be written corresponding to the applet in the storage space corresponding to the client For persistence, the storage space corresponding to the client does not belong to the applet, and does not include the cache of the applet itself.
  13. 如权利要求12所述的装置,所述发起模块,根据所述小程序对应的待写入数据,生成风险填充数据;The device according to claim 12, wherein the initiating module generates risk filling data according to the data to be written corresponding to the applet;
    根据所述风险填充数据,向所述客户端发起所述存储API调用请求,以使所述客户端先将所述风险填充数据在所述客户端对应的存储空间中持久化,以及在所述小程序的生命周期结束时,通过也执行所述存储写入操作,将所述客户端对应的存储空间中持久化的所述风险填充数据替换为所述小程序对应的待写入数据。According to the risk filling data, initiate the storage API call request to the client, so that the client first persists the risk filling data in the storage space corresponding to the client, and in the When the life cycle of the applet ends, by also executing the storage write operation, the risk filling data persisted in the storage space corresponding to the client is replaced with the data to be written corresponding to the applet.
  14. 如权利要求12所述的装置,所述发起模块,相对于对所述小程序自身的缓存执行所述存储写入操作,向所述客户端异步发送所述存储API调用请求;The device according to claim 12, wherein the initiating module sends the storage API call request to the client asynchronously relative to executing the storage write operation on the cache of the applet itself;
    所述装置还包括立即读取模块,所述立即读取模块在所述发起模块对所述小程序自身的缓存执行所述存储写入操作之后,执行:The device further includes an immediate reading module, and after the initiating module executes the storage write operation on the cache of the applet itself, the immediate reading module executes:
    立即从所述小程序自身的缓存读取通过所述存储写入操作所写入的数据。The data written by the storage write operation is immediately read from the applet's own cache.
  15. 如权利要求11所述的装置,所述存储相关操作为存储读取操作;The apparatus according to claim 11, wherein the storage-related operation is a storage read operation;
    所述实现模块,从所述小程序自身的缓存中读取所述存储数据,并返回给所述小程序。The implementation module reads the stored data from the cache of the applet itself, and returns it to the applet.
  16. 如权利要求11所述的装置,所述装置还包括生成模块,所述生成模块在所述校验模块校验所述小程序自身的缓存中是否保存有所述存储API调用请求所针对的存储数据之前,执行:The device according to claim 11, further comprising a generating module, the generating module verifies whether the storage targeted by the storage API call request is saved in the cache of the applet itself in the verification module Before data, execute:
    根据存储缓存管理器的基类,为所述小程序自身的缓存生成小程序缓存管理对象,以便通过所述小程序缓存管理对象的实例,访问所述小程序自身的缓存,以及执行所述校验。According to the base class of the storage cache manager, an applet cache management object is generated for the cache of the applet itself, so that the cache of the applet itself can be accessed through the instance of the applet cache management object, and the calibration can be executed. test.
  17. 如权利要求16所述的装置,所述装置还包括选择模块,所述选择模块在所述校验模块校验所述小程序自身的缓存中是否保存有所述存储API调用请求所针对的存储数据之前,执行:The device according to claim 16, further comprising a selection module, and the selection module verifies whether the storage targeted by the storage API call request is stored in the cache of the applet itself in the verification module. Before data, execute:
    根据存储缓存管理器的基类,为应用的插件的缓存生成插件缓存管理对象,其中,所述客户端属于所述应用或者另一应用;Generate a plug-in cache management object for the cache of the plug-in of the application according to the base class of the storage cache manager, wherein the client belongs to the application or another application;
    根据所述存储API调用请求和/或指定的应用标识,在所述小程序缓存管理对象和所述插件缓存管理对象中选择目标对象。Select a target object from the applet cache management object and the plug-in cache management object according to the storage API call request and/or the specified application identifier.
  18. 如权利要求11所述的装置,所述装置还包括确定模块,所述确定模块在所述实现模块为所述客户端过滤掉所述存储API调用请求之前,执行:The device according to claim 11, further comprising a determination module, before the realization module filters out the storage API call request for the client, the determination module executes:
    确定所述存储相关操作不为存储抹消操作;Determining that the storage-related operation is not a storage erasure operation;
    所述装置还包括清除模块,所述清除模块执行:The apparatus also includes a cleanup module that performs:
    若所述存储相关操作为存储抹消操作,清除所述小程序自身的缓存中的所述存储数据;If the storage-related operation is a storage erasure operation, clearing the stored data in the cache of the applet itself;
    向所述客户端发起所述存储API调用请求,以使所述客户端在所述缓存之外持久化的所述存储数据也被清除。Initiating the storage API call request to the client, so that the storage data persisted by the client outside the cache is also cleared.
  19. 如权利要求11所述的装置,所述存储数据包括键值对中的键,所述存储相关操作为存储读取操作;The device according to claim 11, wherein the stored data includes a key in a key-value pair, and the storage-related operation is a storage read operation;
    所述装置还包括错误记录模块,所述错误记录模块在所述发起模块向所述客户端发起所述存储API调用请求之后,执行:The device also includes an error recording module, and after the initiating module initiates the storage API call request to the client, the error recording module executes:
    若所述客户端响应于所述存储API调用请求,在执行所述存储读取操作时,对所述键的值读取失败,则将所述键确定为错误键并进行记录,以过滤掉用于读取所述错误键的值的存储API调用请求;If the client fails to read the value of the key when performing the storage read operation in response to the storage API call request, then determine the key as an error key and record it to filter out a storage API call request to read the value of said erroneous key;
    在通过执行存储写入操作,为所述键写入值后,确定所述键不再为错误键。After writing a value for the key by performing a store write operation, it is determined that the key is no longer an erroneous key.
  20. 如权利要求11至19任一项所述的装置,所述小程序自身的缓存运行于所述小程序的生命周期中,所述装置还包括销毁模块,所述销毁模块执行:The device according to any one of claims 11 to 19, wherein the cache of the applet itself runs in the life cycle of the applet, and the device further includes a destroying module, the destroying module executes:
    当所述小程序的生命周期结束时,销毁所述小程序自身的缓存,从而所述小程序自身的缓存内的存储数据丢失。When the life cycle of the applet ends, the cache of the applet itself is destroyed, so that the stored data in the cache of the applet itself is lost.
  21. 一种小程序存储调用设备,所述小程序运行于客户端上,所述设备包括至少一个处理器以及与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够:A small program storage and calling device, the small program runs on the client, the device includes at least one processor and a memory connected to the at least one processor in communication; wherein, the memory stores information that can be used by the instructions executed by at least one processor, the instructions being executed by the at least one processor, to enable the at least one processor to:
    在所述小程序要向所述客户端发起存储API调用请求之前,访问所述小程序自身的缓存;Before the applet initiates a storage API call request to the client, access the cache of the applet itself;
    校验所述小程序自身的缓存中是否保存有所述存储API调用请求所针对的存储数据;Verifying whether the storage data targeted by the storage API call request is stored in the cache of the applet itself;
    若是,则为所述客户端过滤掉所述存储API调用请求,并根据所述小程序自身的缓存中的所述存储数据,实现所述存储API调用请求对应的存储相关操作;If so, filter out the storage API call request for the client, and implement storage-related operations corresponding to the storage API call request according to the storage data in the cache of the applet itself;
    否则,向所述客户端发起所述存储API调用请求。Otherwise, initiate the storage API call request to the client.
PCT/CN2023/071496 2022-02-25 2023-01-10 Mini-program storage call WO2023160289A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210180329.5 2022-02-25
CN202210180329.5A CN114510296B (en) 2022-02-25 2022-02-25 Applet storage calling method, device and equipment

Publications (1)

Publication Number Publication Date
WO2023160289A1 true WO2023160289A1 (en) 2023-08-31

Family

ID=81552705

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/071496 WO2023160289A1 (en) 2022-02-25 2023-01-10 Mini-program storage call

Country Status (2)

Country Link
CN (1) CN114510296B (en)
WO (1) WO2023160289A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117312394A (en) * 2023-11-08 2023-12-29 之江实验室 Data access method and device, storage medium and electronic equipment

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114510296B (en) * 2022-02-25 2024-02-02 支付宝(杭州)信息技术有限公司 Applet storage calling method, device and equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150012706A1 (en) * 2013-07-08 2015-01-08 International Business Machines Corporation Managing metadata for caching devices during shutdown and restart procedures
CN109933367A (en) * 2019-02-03 2019-06-25 广州视源电子科技股份有限公司 Cookie implementation method, device and the computer equipment of small routine
CN111708734A (en) * 2020-05-29 2020-09-25 苏州浪潮智能科技有限公司 Metadata access method, system, device and medium for distributed system
CN114510296A (en) * 2022-02-25 2022-05-17 支付宝(杭州)信息技术有限公司 Applet storage and calling method, device and equipment

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20210042398A1 (en) * 2019-08-08 2021-02-11 Pulsepoint, Inc. Validation of Properties of a User Device in a Network
CN113448641A (en) * 2020-03-10 2021-09-28 腾讯科技(深圳)有限公司 Method and device for starting small program, computer equipment and storage medium
CN111930696B (en) * 2020-07-22 2023-08-01 建信金融科技有限责任公司 File transmission processing method and system based on small program
CN112000394B (en) * 2020-08-27 2024-01-09 北京百度网讯科技有限公司 Method, apparatus, device and storage medium for accessing applet

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150012706A1 (en) * 2013-07-08 2015-01-08 International Business Machines Corporation Managing metadata for caching devices during shutdown and restart procedures
CN109933367A (en) * 2019-02-03 2019-06-25 广州视源电子科技股份有限公司 Cookie implementation method, device and the computer equipment of small routine
CN111708734A (en) * 2020-05-29 2020-09-25 苏州浪潮智能科技有限公司 Metadata access method, system, device and medium for distributed system
CN114510296A (en) * 2022-02-25 2022-05-17 支付宝(杭州)信息技术有限公司 Applet storage and calling method, device and equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117312394A (en) * 2023-11-08 2023-12-29 之江实验室 Data access method and device, storage medium and electronic equipment
CN117312394B (en) * 2023-11-08 2024-03-05 之江实验室 Data access method and device, storage medium and electronic equipment

Also Published As

Publication number Publication date
CN114510296B (en) 2024-02-02
CN114510296A (en) 2022-05-17

Similar Documents

Publication Publication Date Title
WO2023160289A1 (en) Mini-program storage call
CN110008224B (en) Database transaction processing method and device
KR102226257B1 (en) Method and device for writing service data to a blockchain system
RU2725690C1 (en) Service processing method and device
JP6876806B2 (en) Blockchain Consensus Formation Methods and Devices
KR100484485B1 (en) Method for storing data in non-volatile memory and apparatus therefor
TWI767106B (en) Method, device and device for configuring payment process and executing payment process
WO2020259289A1 (en) Resource allocation method and apparatus, electronic device and storage medium
CN108549562A (en) A kind of method and device of image load
CN107016016B (en) Data processing method and device
TW201941132A (en) Information display method, apparatus and device
CN110496395B (en) Component operation method, system and equipment for illusion engine
JP2004530201A (en) Methods for loading and running applications in embedded environments
CN115378735B (en) Data processing method and device, storage medium and electronic equipment
CN110851285B (en) Resource multiplexing method, device and equipment based on GPU virtualization
CN110413376A (en) A kind of method, equipment and the storage medium of Virtual Machine Manager USB device
CN115374481B (en) Data desensitization processing method and device, storage medium and electronic equipment
CN116305298B (en) Method and device for managing computing power resources, storage medium and electronic equipment
CN113079224A (en) Account binding method and device, storage medium and electronic equipment
US20240169091A1 (en) Privacy-preserving data risk prevention and control method, apparatus, and device
CN111949297B (en) Block chain intelligent contract upgrading method and device and electronic equipment
CN113553214A (en) Idempotent checking method and device
CN115495343A (en) Safety maintenance method and device, storage medium and electronic equipment
JP2015081918A (en) Device and method for partially updating navigation data during travel
CN112286572A (en) Configuration method and device of business process

Legal Events

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

Ref document number: 23758914

Country of ref document: EP

Kind code of ref document: A1