WO2019061978A1 - Data caching method and apparatus, server and medium - Google Patents

Data caching method and apparatus, server and medium Download PDF

Info

Publication number
WO2019061978A1
WO2019061978A1 PCT/CN2018/074849 CN2018074849W WO2019061978A1 WO 2019061978 A1 WO2019061978 A1 WO 2019061978A1 CN 2018074849 W CN2018074849 W CN 2018074849W WO 2019061978 A1 WO2019061978 A1 WO 2019061978A1
Authority
WO
WIPO (PCT)
Prior art keywords
variable data
data
weight
identification information
importance degree
Prior art date
Application number
PCT/CN2018/074849
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 WO2019061978A1 publication Critical patent/WO2019061978A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2255Hash tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9024Graphs; Linked lists

Definitions

  • the present application belongs to the field of data processing technologies, and in particular, to a data caching method, apparatus, server, and medium.
  • Front-end technology has developed rapidly in recent years, and the performance of front-end code has received more and more attention.
  • Javascript plays an important role in front-end technology.
  • page effects are gradually upgraded, and dom operations More and more frequent, the search based on the js prototype chain is extremely consuming the performance of the program.
  • the embodiment of the present application provides a data caching method and a server to solve the problem that the search for variable data based on the js prototype chain in the prior art affects the running performance of the program.
  • a first aspect of the embodiments of the present application provides a data caching method, including:
  • Each variable data is stored in an ordered sequence, and each variable data is correspondingly provided with an importance degree identification information
  • variable data indicating that the importance degree identification information satisfies the preset condition is inserted into the singly linked list by means of the header insertion manner according to the importance degree identification information of the adjusted variable data; wherein the singly linked list has a preset length.
  • a second aspect of the embodiments of the present application provides a data cache apparatus, including:
  • variable storage module configured to store each variable data in an ordered sequence, and each variable data is correspondingly set with an importance degree identification information
  • the adjustment module is configured to monitor whether each variable data performs an operation, and adjust the importance degree identification information of the variable data that performs the operation when the variable data execution operation is monitored;
  • the insertion module is configured to insert, according to the adjusted importance degree information of each variable data, the variable data whose importance degree identification information meets the preset condition is inserted into the singly linked list by means of a header insertion manner; wherein the singly linked list has a pre- Set the length.
  • a third aspect of the embodiments of the present application provides a data cache server, including a memory, a processor, and the computer storing computer readable instructions executable on the processor, the processor executing the computer The following steps are implemented when the instructions are readable:
  • Each variable data is stored in an ordered sequence, and each variable data is correspondingly provided with an importance degree identification information
  • variable data indicating that the importance degree identification information satisfies the preset condition is inserted into the singly linked list by means of the header insertion manner according to the importance degree identification information of the adjusted variable data; wherein the singly linked list has a preset length.
  • a fourth aspect of the embodiments of the present application provides a computer readable storage medium storing computer readable instructions, wherein the computer readable instructions are implemented by at least one processor The following steps:
  • Each variable data is stored in an ordered sequence, and each variable data is correspondingly provided with an importance degree identification information
  • variable data indicating that the importance degree identification information satisfies the preset condition is inserted into the singly linked list by means of the header insertion manner according to the importance degree identification information of the adjusted variable data; wherein the singly linked list has a preset length.
  • each variable data is stored in an ordered sequence, and each variable data is correspondingly set with a weight, monitoring whether each variable data performs an operation, and when the variable data is monitored, the operation variable is executed.
  • the weight of the data is adjusted.
  • the variable data whose weight meets the preset condition is inserted into the singly linked list through the header insertion mode, and the singly linked list has a fixed length and is stored in a new one.
  • the variable data in the single necklace table is a commonly used variable.
  • the search can be reduced, and the consumption of the program is saved. It can maintain a certain number of js variables in memory for developers to use without having to access the prototype chain frequently to obtain variables, which can greatly improve the performance of variable acquisition.
  • FIG. 1 is a flowchart of a data caching method provided by an embodiment of the present application.
  • FIG. 2 is a flowchart of an implementation of step S101 in FIG. 1;
  • FIG. 3 is a flowchart of an implementation of step S103 in FIG. 1;
  • FIG. 5 is a flowchart of still another data caching method provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram of an operating environment of a data caching program provided by an embodiment of the present application
  • FIG. 7 is a functional block diagram of a data caching program provided by an embodiment of the present application.
  • FIG. 1 is a flowchart showing an implementation process of a data caching method according to Embodiment 1 of the present application, which is described in detail as follows:
  • each variable data is stored in an ordered sequence, and each variable data is correspondingly provided with an importance degree identification information.
  • variable data can be accessed in the form of key-value pairs.
  • all variable data is encapsulated in an object obj, which encapsulates a key (key value) containing a hash as an index, an object weight, and a data entity object.
  • the index can be from 0 to the maximum value of the cacheable variable according to the user configuration.
  • the importance degree identification information may specifically be a weight, that is, each variable data is correspondingly set with a weight, and the initial value of the weight of each variable data may be the same. After the subsequent execution operation, the weight of the variable data changes. For example, it becomes larger or smaller.
  • weight is a relative concept for a certain indicator. The weight of an indicator refers to the relative importance of the indicator in the overall evaluation.
  • each variable data may correspondingly set an initial weight initial value, a preset correspondence between the execution operation and the weight level, and a correspondence between the weight level and the weight adjustment range, and if the execution of a certain variable data is monitored subsequently
  • the operation determines the weight level corresponding to the performed operation of the monitored variable data according to the corresponding relationship between the execution operation and the weight level, and further determines the corresponding weight according to the determined weight level and the correspondence between the weight level and the weight adjustment range.
  • the adjustment range is adjusted according to the determined weight adjustment range to adjust the weight of the above-mentioned monitored variable data.
  • step S101 can be implemented by the following process:
  • Step S201 If the type of the target variable data is Object, acquire an address of the target variable data, and calculate a hash code of the target variable data according to the address, where the target variable data is any one of each variable data. Variable data.
  • Step S202 if the type of the target variable data is String, acquire a character string included in the target variable data, and calculate a hash code of the target variable data according to the character string.
  • Step S203 if the type of the target variable data is Integer, acquire a number included in the target variable data, and calculate a hash code of the target variable data according to the number.
  • the hash code for calculating the variable data can also be a method well known to those skilled in the art, and will not be described here. In this step, the calculated hash code is used as the corresponding variable data.
  • Step S204 after calculating the hash code of each variable data, storing the corresponding variable data into the ordered sequence according to the calculated hash code.
  • the corresponding variable data may be stored in the sequence item of the ordered sequence according to the calculated hash code, and how to store the corresponding variable data into the sequence item of the ordered sequence according to the calculated hash code. This is accomplished with reference to techniques well known to those skilled in the art and will not be described herein.
  • variable data can be stored more uniformly in the ordered sequence.
  • step S102 it is monitored whether each variable data performs an operation, and when the variable data execution operation is monitored, the importance degree identification information of the variable data that performs the operation is adjusted.
  • variable data has been executed recently, it indicates that the variable data is the more commonly used variable data; if a variable data has not been executed for a period of time, it can be stated that the variable data is less commonly used variable data. .
  • variable data can be adjusted according to the importance degree of the variable data, and the variable data is reflected as a relatively common variable data.
  • the variable data identification information of the variable data may be adjusted to reflect that the variable data is relatively less commonly used variable data.
  • the importance level identification information of the variable data may not be adjusted.
  • the importance degree identification information includes a weight
  • the specific implementation process of step S102 may be: when the variable data execution operation is monitored, the weight of the variable data that performs the operation is increased by a preset value.
  • various operations are not distinguished, and as long as the variable data execution operation is monitored, the weight of the variable data for performing the operation is increased by a preset value.
  • the weight of the variable data is A
  • the preset value is B.
  • the weight of the variable data that performs the operation is adjusted to A+B.
  • the preset value can be set according to actual needs.
  • the importance degree identification information includes a weight
  • the specific implementation process of step S102 may be: when monitoring the variable data execution operation, increasing the weight of the variable data that performs the operation according to the operation by a preset value .
  • the operations are differentiated, for example, into at least two types of operations, and the preset values corresponding to each type of operation are different, and the operation with a larger preset value may be a relatively more important operation, and the preset value is Smaller operations can be an important level of operation.
  • variable data may be divided into a first operation and a second operation, wherein the first operation is more important than the second operation, so the preset value C1 corresponding to the first operation is greater than the pre-corresponding to the second operation.
  • the type of the operation and the preset value corresponding to the type are detected, and then the weight of the variable data for performing the operation is increased by a corresponding preset value (for example, C1 or C2). .
  • step S102 may further be: when the variable data execution operation is monitored, the weight of the variable data that performs the operation is reduced by a preset value. At this time, the smaller the weight of the variable data, the more variable data is used; and the larger the weight of the variable data, the more variable data is relatively less common.
  • the importance level identification information of the variable data on which the operation is performed may be adjusted to reduce the weight of the variable data on which the operation is to be performed.
  • step S102 may further be: when monitoring the variable data to perform an operation, reducing the weight of the variable data that performs the operation according to the operation by a preset value.
  • various operations on the variable data may be divided into a first operation and a second operation, wherein the first operation is more important than the second operation, so the preset value C1 corresponding to the first operation is smaller than the pre-corresponding to the second operation.
  • Step S103 according to the adjusted importance degree identification information of each variable data, the variable data whose importance degree identification information satisfies the preset condition is inserted into the singly linked list by means of a header insertion manner; wherein the singly linked list has a preset length .
  • the importance level identification information may be a weight, and the preset condition may be the highest weight or the lowest weight.
  • step S103 can be implemented by the following process:
  • step S301 the variable data with the largest weight among the variable data is acquired once every preset time.
  • the preset time can be set according to actual needs, for example, the variable data with the largest weight among the variable data is obtained every 30 seconds.
  • variable data of each variable data may be obtained by sorting each variable data according to the weight of each variable data.
  • step S302 the variable data with the largest weight is inserted into the singly linked list by means of a header insertion manner.
  • the singly linked list has a fixed length, and when a new variable data is stored, the data at the end of the singly linked list is eliminated. Therefore, the variable data in the single necklace table is a relatively common variable.
  • the search can be reduced, the consumption of the program operation can be saved, and a certain number of js variables can be kept in the memory for the developer to use. It is not necessary to frequently access the prototype chain to obtain variables, which can greatly improve the performance of variable acquisition.
  • variable data with the smallest weight among the individual variable data may be acquired once every preset time, and then the variable data with the smallest weight is inserted into the singly linked list by means of a header insertion manner.
  • the above data caching method stores each variable data in an ordered sequence, and each variable data is correspondingly set with a weight, monitors whether each variable data performs an operation, and performs a variable when the variable data execution operation is monitored.
  • the weight of the data is adjusted.
  • the variable data whose weight meets the preset condition is inserted into the singly linked list through the header insertion mode, and the singly linked list has a fixed length and is stored in a new one.
  • the variable data in the single necklace table is a commonly used variable.
  • the search can be reduced, and the consumption of the program is saved. It can maintain a certain number of js variables in memory for developers to use without having to access the prototype chain frequently to obtain variables, which can greatly improve the performance of variable acquisition.
  • FIG. 4 a flowchart of a data caching method provided in Embodiment 2 of the present application is shown in the following:
  • Step S401 If the type of the target variable data is Object, acquire an address of the target variable data, and calculate a hash code of the target variable data according to the address, where the target variable data is any one of each variable data. Variable data.
  • Step S402 if the type of the target variable data is String, acquire a character string included in the target variable data, and calculate a hash code of the target variable data according to the character string.
  • Step S403 if the type of the target variable data is Integer, acquire a number included in the target variable data, and calculate a hash code of the target variable data according to the number.
  • Step S404 after calculating the hash code of each variable data, storing the corresponding variable data into the ordered sequence according to the calculated hash code.
  • Step S405 it is monitored whether each variable data performs an operation, and when the variable data execution operation is monitored, the weight of the variable data that performs the operation is increased by a preset value.
  • Step S406 The variable data with the largest weight among the variable data is acquired once every preset time, and the variable data with the largest weight is inserted into the singly linked list by means of a header insertion manner.
  • step S405 may further be: monitoring whether each variable data performs an operation, and reducing a weight of the variable data of the performing operation to a preset value when the variable data execution operation is monitored.
  • step S406 may be: acquiring variable data with the smallest weight among the variable data once every preset time, and inserting the variable data with the smallest weight into the singly linked list by means of a header insertion manner.
  • FIG. 5 a flowchart of a data caching method provided in Embodiment 3 of the present application is shown in the following:
  • Step S501 If the type of the target variable data is Object, acquire an address of the target variable data, and calculate a hash code of the target variable data according to the address, where the target variable data is any one of the variable data. Variable data.
  • Step S502 if the type of the target variable data is String, acquire a character string included in the target variable data, and calculate a hash code of the target variable data according to the character string.
  • Step S503 if the type of the target variable data is Integer, acquire a number included in the target variable data, and calculate a hash code of the target variable data according to the number.
  • Step S504 after calculating the hash code of each variable data, storing the corresponding variable data into the ordered sequence according to the calculated hash code.
  • step S505 it is monitored whether the respective variable data performs an operation, and when the variable data execution operation is monitored, the weight of the variable data that performs the operation is increased by a preset value according to the operation.
  • Step S506 the variable data with the largest weight among the variable data is acquired once every preset time, and the variable data with the largest weight is inserted into the singly linked list by means of a header insertion manner.
  • step S505 may further be: monitoring whether each variable data performs an operation, and when monitoring the variable data to perform an operation, reducing a weight of the variable data of the performing operation according to the operation by a preset value.
  • step S506 may be: acquiring variable data with the smallest weight among the variable data once every preset time, and inserting the variable data with the smallest weight into the singly linked list by means of a header insertion manner.
  • FIG. 6 is a schematic diagram showing the operating environment of the data caching program provided by the embodiment of the present application. For the convenience of explanation, only the parts related to the present embodiment are shown.
  • the data caching program 600 is installed and runs in the server 60.
  • the server 60 can include, but is not limited to, a memory 601 and a processor 602.
  • Figure 6 shows only server 60 with components 601-602, but it should be understood that not all illustrated components may be implemented and that more or fewer components may be implemented instead.
  • the memory 601 may be an internal storage unit of the server 60, such as a hard disk or memory of the server 60, in some embodiments.
  • the memory 601 may also be an external storage device of the server 60 in other embodiments, such as a plug-in hard disk equipped on the server 60, a smart memory card (SMC), and a secure digital number (Secure). Digital, SD) cards, flash cards, etc.
  • the memory 601 may also include both an internal storage unit of the server 60 and an external storage device.
  • the memory 601 is configured to store application software and various types of data installed in the server 60, such as program codes of the data cache program 600, and the like.
  • the memory 601 can also be used to temporarily store data that has been output or is about to be output.
  • the processor 602 can be a central processor (Central) in some embodiments A processing unit (CPU), a microprocessor or other data processing chip for running program code or processing data stored in the memory 601, such as executing the data caching program 600 and the like.
  • Central central processor
  • CPU central processing unit
  • microprocessor microprocessor or other data processing chip for running program code or processing data stored in the memory 601, such as executing the data caching program 600 and the like.
  • a display can also be included.
  • the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch sensor, or the like in some embodiments.
  • the display is for displaying information processed in the server 60 and a user interface for displaying visualizations, such as an application menu interface, an application icon interface, and the like.
  • the components 601-62 of the server 60 communicate with one another via a system bus.
  • FIG. 7 is a functional block diagram of a data caching program 600 provided by an embodiment of the present application.
  • the data caching program 600 may be divided into one or more modules, and the one or more modules are stored in the memory 601 and executed by one or more processors (this implementation) An example is performed by the processor 602) to complete the application.
  • the data cache program 600 can be divided into a variable storage module 701, a detection adjustment module 702, and a processing module 703.
  • a module as referred to in this application refers to a series of computer readable instruction instructions that are capable of performing a particular function, and are more suitable than the program to describe the execution of the data caching program 600 in the server 60. The following description will specifically describe the functions of the modules 701-703.
  • the variable storage module 701 is configured to store each variable data in an ordered sequence, and each variable data is correspondingly set with a weight.
  • the detection adjustment module 702 is configured to monitor whether each variable data performs an operation, and adjust the weight of the variable data that performs the operation when the variable data execution operation is monitored.
  • the processing module 703 is configured to insert the variable data whose weight meets the preset condition into the singly linked list according to the weight of the adjusted variable data, wherein the singly linked list has a preset length.
  • variable storage module 701 may include a first calculation unit, a second calculation unit, a third calculation unit, and a storage unit.
  • the first calculating unit is configured to acquire an address of the target variable data if the type of the target variable data is Object, and calculate a hash code of the target variable data according to the address, where the target variable data is each Any variable data in the variable data.
  • the second calculating unit is configured to: if the type of the target variable data is a String, acquire a character string included in the target variable data, and calculate a hash code of the target variable data according to the character string.
  • the third calculating unit is configured to: if the type of the target variable data is Integer, acquire a number included in the target variable data, and calculate a hash code of the target variable data according to the number.
  • the storage unit is configured to store the corresponding variable data into the ordered sequence according to the calculated hash code after calculating the hash code of each variable data.
  • the monitoring adjustment module 702 is specifically configured to:
  • the weight of the variable data on which the operation is performed is increased by a preset value
  • the weight of the variable data on which the operation is performed is increased by a preset value according to the operation.
  • the processing module 703 can include an obtaining unit and an inserting unit.
  • the obtaining unit is configured to acquire variable data with the largest weight among the variable data once every preset time.
  • the inserting unit is configured to insert the variable data with the largest weight into the singly linked list by means of a header insertion manner.
  • each functional unit and module in the foregoing system may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit, and the integrated unit may be implemented by hardware.
  • Formal implementation can also be implemented in the form of software functional units.
  • the specific names of the respective functional units and modules are only for the purpose of facilitating mutual differentiation, and are not intended to limit the scope of protection of the present application.
  • the disclosed apparatus/server and method may be implemented in other manners.
  • the device/server embodiment described above is merely illustrative.
  • the division of the module or unit is only a logical function division, and the actual implementation may have another division manner, such as multiple units or Components can be combined or integrated into another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in electrical, mechanical or other form.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
  • the integrated modules/units if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium.
  • the present application implements all or part of the processes in the foregoing embodiments, and may also be implemented by computer readable instructions, which may be stored in a computer readable storage medium.
  • the computer readable instructions when executed by a processor, may implement the steps of the various method embodiments described above.
  • the computer readable instructions comprise computer readable instruction code, which may be in the form of source code, an object code form, an executable file or some intermediate form or the like.
  • the computer readable medium can include any entity or device capable of carrying the computer readable instruction code, a recording medium, a USB flash drive, a removable hard drive, a magnetic disk, an optical disk, a computer memory, a read only memory (ROM, Read-Only) Memory), random access memory (RAM, Random) Access Memory), electrical carrier signals, telecommunications signals, and software distribution media.
  • ROM Read Only memory
  • RAM Random Access Memory
  • electrical carrier signals telecommunications signals
  • telecommunications signals and software distribution media. It should be noted that the content contained in the computer readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in a jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, computer readable media Does not include electrical carrier signals and telecommunication signals.

Abstract

A data caching method and apparatus, a server and a medium. The method comprises: saving various pieces of variable data in an ordered sequence, wherein a weight is correspondingly set for each variable data (S101); monitoring whether the pieces of variable data execute operations, and when it is monitored that the variable data execute the operations, adjusting the weights of the variable data executing the operations (S102); and according to the adjusted weight of each piece of variable data, inserting variable data with the weights meeting a pre-set condition into a one-way chain table in a header inserting mode, wherein the one-way chain table has a pre-set length (S103). According to the data caching method and the server, searching can be reduced by directly calling variable data from a one-way chain table, saving on the running consumption of programs, and a certain number of js variables can be kept in a memory for use by developers without frequently having to access a prototype chain to acquire variables, such that the performance of variable acquisition can be greatly improved.

Description

一种数据缓存方法、装置、服务器及介质Data cache method, device, server and medium
本申请要求于2017年09月26日提交中国专利局、申请号为201710880106.9、发明名称为“一种数据缓存方法及服务器”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims the priority of the Chinese Patent Application, filed on Sep. 26, 2017, the entire disclosure of which is hereby incorporated by reference. .
技术领域Technical field
本申请属于数据处理技术领域,尤其涉及一种数据缓存方法、装置、服务器及介质。The present application belongs to the field of data processing technologies, and in particular, to a data caching method, apparatus, server, and medium.
背景技术Background technique
前端技术近几年发展迅猛,前端代码的性能越来越受到关注,而javascript在前端技术中有着举足轻重的作用,随着用户和企业对系统的体验愈发重视,页面特效逐步升级,dom的操作愈发频繁,基于js原型链的搜索极其消耗程序运行的性能。Front-end technology has developed rapidly in recent years, and the performance of front-end code has received more and more attention. Javascript plays an important role in front-end technology. As users and enterprises pay more attention to the system experience, page effects are gradually upgraded, and dom operations More and more frequent, the search based on the js prototype chain is extremely consuming the performance of the program.
技术问题technical problem
有鉴于此,本申请实施例提供了数据缓存方法及服务器,以解决现有技术中基于js原型链的对变量数据的搜索影响程序运行性能的问题。In view of this, the embodiment of the present application provides a data caching method and a server to solve the problem that the search for variable data based on the js prototype chain in the prior art affects the running performance of the program.
技术解决方案Technical solution
本申请实施例的第一方面提供了一种数据缓存方法,包括:A first aspect of the embodiments of the present application provides a data caching method, including:
将各个变量数据存入有序序列中,每个变量数据对应设置有一个重要程度标识信息;Each variable data is stored in an ordered sequence, and each variable data is correspondingly provided with an importance degree identification information;
监测各个变量数据是否执行操作,并在监测到变量数据执行操作时,将执行操作的变量数据的重要程度标识信息进行调整;Monitoring whether each variable data performs an operation, and adjusting the importance degree identification information of the variable data of the execution operation when monitoring the variable data execution operation;
根据调整后的各个变量数据的重要程度标识信息,将重要程度标识信息满足预设条件的变量数据通过表头插入方式插入单向链表中;其中,所述单向链表具有预设长度。The variable data indicating that the importance degree identification information satisfies the preset condition is inserted into the singly linked list by means of the header insertion manner according to the importance degree identification information of the adjusted variable data; wherein the singly linked list has a preset length.
本申请实施例的第二方面提供了一种数据缓存装置,包括:A second aspect of the embodiments of the present application provides a data cache apparatus, including:
变量存储模块,用于将各个变量数据存入有序序列中,每个变量数据对应设置有一个重要程度标识信息;a variable storage module, configured to store each variable data in an ordered sequence, and each variable data is correspondingly set with an importance degree identification information;
调整模块,用于监测各个变量数据是否执行操作,并在监测到变量数据执行操作时,将执行操作的变量数据的重要程度标识信息进行调整;The adjustment module is configured to monitor whether each variable data performs an operation, and adjust the importance degree identification information of the variable data that performs the operation when the variable data execution operation is monitored;
插入模块,用于根据调整后的各个变量数据的重要程度标识信息,将重要程度标识信息满足预设条件的变量数据通过表头插入方式插入单向链表中;其中,所述单向链表具有预设长度。The insertion module is configured to insert, according to the adjusted importance degree information of each variable data, the variable data whose importance degree identification information meets the preset condition is inserted into the singly linked list by means of a header insertion manner; wherein the singly linked list has a pre- Set the length.
本申请实施例的第三方面提供了一种数据缓存服务器,包括存储器、处理器,所述存储器上存储有可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:A third aspect of the embodiments of the present application provides a data cache server, including a memory, a processor, and the computer storing computer readable instructions executable on the processor, the processor executing the computer The following steps are implemented when the instructions are readable:
将各个变量数据存入有序序列中,每个变量数据对应设置有一个重要程度标识信息;Each variable data is stored in an ordered sequence, and each variable data is correspondingly provided with an importance degree identification information;
监测各个变量数据是否执行操作,并在监测到变量数据执行操作时,将执行操作的变量数据的重要程度标识信息进行调整;Monitoring whether each variable data performs an operation, and adjusting the importance degree identification information of the variable data of the execution operation when monitoring the variable data execution operation;
根据调整后的各个变量数据的重要程度标识信息,将重要程度标识信息满足预设条件的变量数据通过表头插入方式插入单向链表中;其中,所述单向链表具有预设长度。The variable data indicating that the importance degree identification information satisfies the preset condition is inserted into the singly linked list by means of the header insertion manner according to the importance degree identification information of the adjusted variable data; wherein the singly linked list has a preset length.
本申请实施例的第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,其特征在于,所述计算机可读指令被至少一个处理器执行时实现如下步骤:A fourth aspect of the embodiments of the present application provides a computer readable storage medium storing computer readable instructions, wherein the computer readable instructions are implemented by at least one processor The following steps:
将各个变量数据存入有序序列中,每个变量数据对应设置有一个重要程度标识信息;Each variable data is stored in an ordered sequence, and each variable data is correspondingly provided with an importance degree identification information;
监测各个变量数据是否执行操作,并在监测到变量数据执行操作时,将执行操作的变量数据的重要程度标识信息进行调整;Monitoring whether each variable data performs an operation, and adjusting the importance degree identification information of the variable data of the execution operation when monitoring the variable data execution operation;
根据调整后的各个变量数据的重要程度标识信息,将重要程度标识信息满足预设条件的变量数据通过表头插入方式插入单向链表中;其中,所述单向链表具有预设长度。The variable data indicating that the importance degree identification information satisfies the preset condition is inserted into the singly linked list by means of the header insertion manner according to the importance degree identification information of the adjusted variable data; wherein the singly linked list has a preset length.
有益效果Beneficial effect
本申请实施例,将各个变量数据存入有序序列中,且每个变量数据对应设置有一个权重,监测各个变量数据是否执行操作,并在监测到变量数据执行操作时,将执行操作的变量数据的权重进行调整,根据调整后的各个变量数据的权重,将权重满足预设条件的变量数据通过表头插入方式插入单向链表中,而单向链表具有固定的长度,在存入新的变量数据时,单向链表中表尾的数据就会被淘汰,因此单项链表中的变量数据均为比较常用的变量,通过从单向链表中直接调用变量数据能够减少搜索,节省程序运行的消耗,能在内存中保持一定数量的js变量供开发者使用而不必频繁的访问原型链来获取变量,从而能够极大地提高变量获取的性能。In the embodiment of the present application, each variable data is stored in an ordered sequence, and each variable data is correspondingly set with a weight, monitoring whether each variable data performs an operation, and when the variable data is monitored, the operation variable is executed. The weight of the data is adjusted. According to the weight of each adjusted variable data, the variable data whose weight meets the preset condition is inserted into the singly linked list through the header insertion mode, and the singly linked list has a fixed length and is stored in a new one. When the variable data is used, the data at the end of the singly linked list will be eliminated. Therefore, the variable data in the single necklace table is a commonly used variable. By directly calling the variable data from the singly linked list, the search can be reduced, and the consumption of the program is saved. It can maintain a certain number of js variables in memory for developers to use without having to access the prototype chain frequently to obtain variables, which can greatly improve the performance of variable acquisition.
附图说明DRAWINGS
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the embodiments or the prior art description will be briefly described below. Obviously, the drawings in the following description are only the present application. For some embodiments, other drawings may be obtained from those of ordinary skill in the art without departing from the drawings.
图1是本申请实施例提供的数据缓存方法的流程图;1 is a flowchart of a data caching method provided by an embodiment of the present application;
图2是图1中步骤S101的实现流程图;FIG. 2 is a flowchart of an implementation of step S101 in FIG. 1;
图3是图1中步骤S103的实现流程图;FIG. 3 is a flowchart of an implementation of step S103 in FIG. 1;
图4是本申请实施例提供的另一数据缓存方法的流程图;4 is a flowchart of another data caching method provided by an embodiment of the present application;
图5是本申请实施例提供的又一数据缓存方法的流程图;FIG. 5 is a flowchart of still another data caching method provided by an embodiment of the present application;
图6是本申请实施例提供的数据缓存程序的运行环境示意图6 is a schematic diagram of an operating environment of a data caching program provided by an embodiment of the present application
图7是本申请实施例提供的数据缓存程序的功能模块图。FIG. 7 is a functional block diagram of a data caching program provided by an embodiment of the present application.
本发明的实施方式Embodiments of the invention
以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。在其它情况中,省略对众所周知的系统、装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。In the following description, for purposes of illustration and description However, it will be apparent to those skilled in the art that the present invention may be practiced in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the application.
为了说明本申请所述的技术方案,下面通过具体实施例来进行说明。In order to explain the technical solutions described in the present application, the following description will be made by way of specific embodiments.
本申请实施例的说明书和权利要求书中的技术术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施。The technical terms "first", "second" and the like in the specification and claims of the embodiments of the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order of precedence. It is to be understood that the data so used may be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein.
为了说明本申请所述的技术方案,下面通过具体实施例来进行说明。In order to explain the technical solutions described in the present application, the following description will be made by way of specific embodiments.
实施例一Embodiment 1
图1示出了本申请实施例一提供的数据缓存方法的实现流程,详述如下:FIG. 1 is a flowchart showing an implementation process of a data caching method according to Embodiment 1 of the present application, which is described in detail as follows:
步骤S101,将各个变量数据存入有序序列中,每个变量数据对应设置有一个重要程度标识信息。In step S101, each variable data is stored in an ordered sequence, and each variable data is correspondingly provided with an importance degree identification information.
其中,可以通过键值对的形式来存取变量数据。例如,所有变量数据封装在一个对象obj内,该对象obj内封装存储有包含hash的key(关键值)为index(索引)、对象权重和数据实体对象。index根据用户配置此值可以为从0到可缓存变量的最大值。Among them, variable data can be accessed in the form of key-value pairs. For example, all variable data is encapsulated in an object obj, which encapsulates a key (key value) containing a hash as an index, an object weight, and a data entity object. The index can be from 0 to the maximum value of the cacheable variable according to the user configuration.
本实施例中,所述重要程度标识信息具体可以为权重,即每个变量数据对应设置一个权重,各个变量数据的权重的初始值可以相同,在后续执行操作之后,变量数据的权重发生变化,例如变大或变小。这里,权重是一个相对的概念,针对某一指标而言。某一指标的权重是指该指标在整体评价中的相对重要程度。具体地,每个变量数据可以对应设置一个相同的权重初始值,预设执行操作与权重级别的对应关系,以及权重级别与权重调整范围的对应关系,在后续如果监测到某一变量数据的执行操作,根据上述执行操作与权重级别的对应关系,确定监测到的变量数据的执行操作对应的权重级别,进一步,根据确定的权重级别和上述权重级别与权重调整范围的对应关系,确定相应的权重调整范围,根据确定的权重调整范围对上述监测到的变量数据的权重进行调整。In this embodiment, the importance degree identification information may specifically be a weight, that is, each variable data is correspondingly set with a weight, and the initial value of the weight of each variable data may be the same. After the subsequent execution operation, the weight of the variable data changes. For example, it becomes larger or smaller. Here, weight is a relative concept for a certain indicator. The weight of an indicator refers to the relative importance of the indicator in the overall evaluation. Specifically, each variable data may correspondingly set an initial weight initial value, a preset correspondence between the execution operation and the weight level, and a correspondence between the weight level and the weight adjustment range, and if the execution of a certain variable data is monitored subsequently The operation determines the weight level corresponding to the performed operation of the monitored variable data according to the corresponding relationship between the execution operation and the weight level, and further determines the corresponding weight according to the determined weight level and the correspondence between the weight level and the weight adjustment range. The adjustment range is adjusted according to the determined weight adjustment range to adjust the weight of the above-mentioned monitored variable data.
参见图2,一个实施例中,步骤S101可以通过以下过程实现:Referring to FIG. 2, in an embodiment, step S101 can be implemented by the following process:
步骤S201,若目标变量数据的类型为Object,则获取所述目标变量数据的地址,根据所述地址计算所述目标变量数据的哈希码,所述目标变量数据为各个变量数据中的任意一个变量数据。Step S201: If the type of the target variable data is Object, acquire an address of the target variable data, and calculate a hash code of the target variable data according to the address, where the target variable data is any one of each variable data. Variable data.
步骤S202,若所述目标变量数据的类型为String,则获取所述目标变量数据中包含的字符串,根据所述字符串计算所述目标变量数据的哈希码。Step S202, if the type of the target variable data is String, acquire a character string included in the target variable data, and calculate a hash code of the target variable data according to the character string.
步骤S203,若所述目标变量数据的类型为Integer,则获取所述目标变量数据中包含的数字,根据所述数字计算所述目标变量数据的哈希码。Step S203, if the type of the target variable data is Integer, acquire a number included in the target variable data, and calculate a hash code of the target variable data according to the number.
其中,可以通过setData方法,调用H(key)通过index值算出各个变量的哈希码。计算变量数据的哈希码还可以采用本领域技术人员所熟知的方法,在此不在赘述。本步骤中,将计算出的哈希码作为对应的变量数据。Among them, you can use the setData method, call H (key) to calculate the hash code of each variable through the index value. The hash code for calculating the variable data can also be a method well known to those skilled in the art, and will not be described here. In this step, the calculated hash code is used as the corresponding variable data.
步骤S204,在计算得到各个变量数据的哈希码后,根据计算得到的哈希码将对应的变量数据存入有序序列中。Step S204, after calculating the hash code of each variable data, storing the corresponding variable data into the ordered sequence according to the calculated hash code.
具体的,可以根据计算出的哈希码将对应的变量数据存入有序序列的序列项中,具体如何根据计算出的哈希码将对应的变量数据存入有序序列的序列项中可以参照本领域技术人员所熟知的技术完成,在此不再赘述。Specifically, the corresponding variable data may be stored in the sequence item of the ordered sequence according to the calculated hash code, and how to store the corresponding variable data into the sequence item of the ordered sequence according to the calculated hash code. This is accomplished with reference to techniques well known to those skilled in the art and will not be described herein.
可以理解的,通过计算各个变量的哈希码,然后根据哈希码将对应的变量数据存入有序序列中,能够使得变量数据在有序序列中存储的更加均匀It can be understood that by calculating the hash code of each variable and then storing the corresponding variable data in the ordered sequence according to the hash code, the variable data can be stored more uniformly in the ordered sequence.
步骤S102,监测各个变量数据是否执行操作,并在监测到变量数据执行操作时,将执行操作的变量数据的重要程度标识信息进行调整。In step S102, it is monitored whether each variable data performs an operation, and when the variable data execution operation is monitored, the importance degree identification information of the variable data that performs the operation is adjusted.
其中,所述操作具体可以为被调用,但并不限于此。若某个变量数据最近有执行操作,则说明该变量数据为较为常用的变量数据;若某个变量数据在一段时间内一直未有执行操作,则可以说明该变量数据为不太常用的变量数据。The operation may be specifically called, but is not limited thereto. If a variable data has been executed recently, it indicates that the variable data is the more commonly used variable data; if a variable data has not been executed for a period of time, it can be stated that the variable data is less commonly used variable data. .
可以理解的,若监测到某个变量数据执行操作时,可以通过对该变量数据的重要程度标识信息进行调整的方式,体现出该变量数据为相对较为常用的变量数据。而在一定时间内一直未监测到某个变量数据执行操作时,也可以通过对该变量数据的重要程度标识信息进行调整的方式,体现出该变量数据为相对不太常用的变量数据。或者,在一定时间内一直未监测到某个变量数据执行操作时,可以不对该变量数据的重要程度标识信息进行调整。It can be understood that if a certain variable data is detected to perform an operation, the variable data can be adjusted according to the importance degree of the variable data, and the variable data is reflected as a relatively common variable data. When a certain variable data execution operation has not been monitored for a certain period of time, the variable data identification information of the variable data may be adjusted to reflect that the variable data is relatively less commonly used variable data. Alternatively, when a variable data execution operation has not been monitored for a certain period of time, the importance level identification information of the variable data may not be adjusted.
作为一种可实施方式,所述重要程度标识信息包括权重,步骤S102具体实现过程可以为:在监测到变量数据执行操作时,将执行操作的变量数据的权重增大预设值。As an implementation manner, the importance degree identification information includes a weight, and the specific implementation process of step S102 may be: when the variable data execution operation is monitored, the weight of the variable data that performs the operation is increased by a preset value.
本实施例中,将各种操作不做区分,只要监测到变量数据执行操作,则将执行操作的变量数据的权重增大一个预设值。例如,在监测到变量数据执行操作之前,变量数据的权重为A,预设值为B,则在监测到变量数据执行操作时,将执行操作的变量数据的权重调整为A+B。其中,预设值可以根据实际需要进行设置。In this embodiment, various operations are not distinguished, and as long as the variable data execution operation is monitored, the weight of the variable data for performing the operation is increased by a preset value. For example, before the variable data execution operation is monitored, the weight of the variable data is A, and the preset value is B. When the variable data execution operation is monitored, the weight of the variable data that performs the operation is adjusted to A+B. The preset value can be set according to actual needs.
作为另一种可实施方式,所述重要程度标识信息包括权重,步骤S102具体实现过程可以为:监测到变量数据执行操作时,根据所述操作将执行操作的变量数据的权重增大预设值。As another implementation manner, the importance degree identification information includes a weight, and the specific implementation process of step S102 may be: when monitoring the variable data execution operation, increasing the weight of the variable data that performs the operation according to the operation by a preset value .
本实施例中,对各种操作进行区分,例如可以化为至少两类操作,每类操作对应的预设值不同,预设值较大的操作可以为相对更为重要的操作,预设值较小的操作可以为重要程度交底的操作。In this embodiment, the operations are differentiated, for example, into at least two types of operations, and the preset values corresponding to each type of operation are different, and the operation with a larger preset value may be a relatively more important operation, and the preset value is Smaller operations can be an important level of operation.
例如,对变量数据的各种操作可以分为第一操作和第二操作,其中第一操作相对于第二操作更为重要,因此第一操作对应的预设值C1大于第二操作对应的预设值C2。在监测到某个变量数据执行操作时,再检测该操作的种类和和该种类对应的预设值,然后将执行操作的变量数据的权重增大相应的预设值(例如为C1或C2)。For example, various operations on the variable data may be divided into a first operation and a second operation, wherein the first operation is more important than the second operation, so the preset value C1 corresponding to the first operation is greater than the pre-corresponding to the second operation. Set the value C2. When a variable data operation is detected, the type of the operation and the preset value corresponding to the type are detected, and then the weight of the variable data for performing the operation is increased by a corresponding preset value (for example, C1 or C2). .
通过设置操作的种类和对应的预设值,能够将各种操作的重要程度考虑进去,从而使得步骤S103中提高将重要程度较高的操作对应的变量数据插入单向链表中的概率。By setting the kind of operation and the corresponding preset value, it is possible to take into account the importance of various operations, thereby increasing the probability that the variable data corresponding to the more important operation is inserted into the singly linked list in step S103.
另外,步骤S102具体实现过程还可以为:在监测到变量数据执行操作时,将执行操作的变量数据的权重减小预设值。此时,变量数据的权重越小,则说明该变量数据为相对较为常用的变量数据;而变量数据的权重越大,则说明该变量数据为相对较为不常用的变量数据。在监测到变量数据执行操作时,将执行操作的变量数据的重要程度标识信息进行调整可以为将执行操作的变量数据的权重减小。In addition, the specific implementation process of step S102 may further be: when the variable data execution operation is monitored, the weight of the variable data that performs the operation is reduced by a preset value. At this time, the smaller the weight of the variable data, the more variable data is used; and the larger the weight of the variable data, the more variable data is relatively less common. When the variable data execution operation is monitored, the importance level identification information of the variable data on which the operation is performed may be adjusted to reduce the weight of the variable data on which the operation is to be performed.
另外,步骤S102具体实现过程还可以为:监测到变量数据执行操作时,根据所述操作将执行操作的变量数据的权重减小预设值。例如,对变量数据的各种操作可以分为第一操作和第二操作,其中第一操作相对于第二操作更为重要,因此第一操作对应的预设值C1小于第二操作对应的预设值C2。在监测到某个变量数据执行操作时,再检测该操作的种类和和该种类对应的预设值,然后将执行操作的变量数据的权重较小相应的预设值(例如为C1或C2)。In addition, the specific implementation process of step S102 may further be: when monitoring the variable data to perform an operation, reducing the weight of the variable data that performs the operation according to the operation by a preset value. For example, various operations on the variable data may be divided into a first operation and a second operation, wherein the first operation is more important than the second operation, so the preset value C1 corresponding to the first operation is smaller than the pre-corresponding to the second operation. Set the value C2. When a variable data operation is detected, the type of the operation and the preset value corresponding to the type are detected, and then the weight of the variable data that performs the operation is smaller than the corresponding preset value (for example, C1 or C2). .
步骤S103,根据调整后的各个变量数据的重要程度标识信息,将重要程度标识信息满足预设条件的变量数据通过表头插入方式插入单向链表中;其中,所述单向链表具有预设长度。Step S103, according to the adjusted importance degree identification information of each variable data, the variable data whose importance degree identification information satisfies the preset condition is inserted into the singly linked list by means of a header insertion manner; wherein the singly linked list has a preset length .
其中,重要程度标识信息可以为权重,预设条件可以为权重最高或权重最低。The importance level identification information may be a weight, and the preset condition may be the highest weight or the lowest weight.
参见图3,一个实施例中,步骤S103可以通过以下过程实现:Referring to FIG. 3, in an embodiment, step S103 can be implemented by the following process:
步骤S301,每隔预设时间获取一次各个变量数据中权重最大的变量数据。In step S301, the variable data with the largest weight among the variable data is acquired once every preset time.
其中,预设时间可以根据实际需要进行设定,例如每隔30秒获取一次各个变量数据中权重最大的变量数据。The preset time can be set according to actual needs, for example, the variable data with the largest weight among the variable data is obtained every 30 seconds.
例如,可以按照各个变量数据的权重大小对各个变量数据进行排序的方式,来获取各个变量数据中权重最大的变量数据。For example, the variable data of each variable data may be obtained by sorting each variable data according to the weight of each variable data.
步骤S302,将权重最大的变量数据通过表头插入方式插入所述单向链表中。In step S302, the variable data with the largest weight is inserted into the singly linked list by means of a header insertion manner.
其中,单向链表具有固定的长度,在存入一个新的变量数据时,单向链表中表尾的数据就会被淘汰。因此,单项链表中的变量数据均为比较常用的变量,通过从单向链表中直接调用变量数据能够减少搜索,节省程序运行的消耗,能在内存中保持一定数量的js变量供开发者使用而不必频繁的访问原型链来获取变量,从而能够极大地提高变量获取的性能。Among them, the singly linked list has a fixed length, and when a new variable data is stored, the data at the end of the singly linked list is eliminated. Therefore, the variable data in the single necklace table is a relatively common variable. By directly calling the variable data from the singly linked list, the search can be reduced, the consumption of the program operation can be saved, and a certain number of js variables can be kept in the memory for the developer to use. It is not necessary to frequently access the prototype chain to obtain variables, which can greatly improve the performance of variable acquisition.
另外,还可以每隔预设时间获取一次各个变量数据中权重最小的变量数据,然后将权重最小的变量数据通过表头插入方式插入所述单向链表中。In addition, the variable data with the smallest weight among the individual variable data may be acquired once every preset time, and then the variable data with the smallest weight is inserted into the singly linked list by means of a header insertion manner.
上述数据缓存方法,将各个变量数据存入有序序列中,且每个变量数据对应设置有一个权重,监测各个变量数据是否执行操作,并在监测到变量数据执行操作时,将执行操作的变量数据的权重进行调整,根据调整后的各个变量数据的权重,将权重满足预设条件的变量数据通过表头插入方式插入单向链表中,而单向链表具有固定的长度,在存入新的变量数据时,单向链表中表尾的数据就会被淘汰,因此单项链表中的变量数据均为比较常用的变量,通过从单向链表中直接调用变量数据能够减少搜索,节省程序运行的消耗,能在内存中保持一定数量的js变量供开发者使用而不必频繁的访问原型链来获取变量,从而能够极大地提高变量获取的性能。The above data caching method stores each variable data in an ordered sequence, and each variable data is correspondingly set with a weight, monitors whether each variable data performs an operation, and performs a variable when the variable data execution operation is monitored. The weight of the data is adjusted. According to the weight of each adjusted variable data, the variable data whose weight meets the preset condition is inserted into the singly linked list through the header insertion mode, and the singly linked list has a fixed length and is stored in a new one. When the variable data is used, the data at the end of the singly linked list will be eliminated. Therefore, the variable data in the single necklace table is a commonly used variable. By directly calling the variable data from the singly linked list, the search can be reduced, and the consumption of the program is saved. It can maintain a certain number of js variables in memory for developers to use without having to access the prototype chain frequently to obtain variables, which can greatly improve the performance of variable acquisition.
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that the size of the sequence of the steps in the above embodiments does not mean that the order of execution is performed. The order of execution of each process should be determined by its function and internal logic, and should not be construed as limiting the implementation process of the embodiments of the present application.
实施例二Embodiment 2
参见图4,示出了本申请实施例二提供的数据缓存方法的流程图,详述如下:Referring to FIG. 4, a flowchart of a data caching method provided in Embodiment 2 of the present application is shown in the following:
步骤S401,若目标变量数据的类型为Object,则获取所述目标变量数据的地址,根据所述地址计算所述目标变量数据的哈希码,所述目标变量数据为各个变量数据中的任意一个变量数据。Step S401: If the type of the target variable data is Object, acquire an address of the target variable data, and calculate a hash code of the target variable data according to the address, where the target variable data is any one of each variable data. Variable data.
步骤S402,若所述目标变量数据的类型为String,则获取所述目标变量数据中包含的字符串,根据所述字符串计算所述目标变量数据的哈希码。Step S402, if the type of the target variable data is String, acquire a character string included in the target variable data, and calculate a hash code of the target variable data according to the character string.
步骤S403,若所述目标变量数据的类型为Integer,则获取所述目标变量数据中包含的数字,根据所述数字计算所述目标变量数据的哈希码。Step S403, if the type of the target variable data is Integer, acquire a number included in the target variable data, and calculate a hash code of the target variable data according to the number.
步骤S404,在计算得到各个变量数据的哈希码后,根据计算得到的哈希码将对应的变量数据存入有序序列中。Step S404, after calculating the hash code of each variable data, storing the corresponding variable data into the ordered sequence according to the calculated hash code.
步骤S405,监测各个变量数据是否执行操作,并在监测到变量数据执行操作时,将执行操作的变量数据的权重增大预设值。Step S405, it is monitored whether each variable data performs an operation, and when the variable data execution operation is monitored, the weight of the variable data that performs the operation is increased by a preset value.
步骤S406,每隔预设时间获取一次各个变量数据中权重最大的变量数据,将权重最大的变量数据通过表头插入方式插入所述单向链表中。Step S406: The variable data with the largest weight among the variable data is acquired once every preset time, and the variable data with the largest weight is inserted into the singly linked list by means of a header insertion manner.
另外,步骤S405还可以为:监测各个变量数据是否执行操作,并在监测到变量数据执行操作时,将执行操作的变量数据的权重减小预设值。对应的,步骤S406可以为:每隔预设时间获取一次各个变量数据中权重最小的变量数据,将权重最小的变量数据通过表头插入方式插入所述单向链表中。In addition, step S405 may further be: monitoring whether each variable data performs an operation, and reducing a weight of the variable data of the performing operation to a preset value when the variable data execution operation is monitored. Correspondingly, step S406 may be: acquiring variable data with the smallest weight among the variable data once every preset time, and inserting the variable data with the smallest weight into the singly linked list by means of a header insertion manner.
实施例三Embodiment 3
参见图5,示出了本申请实施例三提供的数据缓存方法的流程图,详述如下:Referring to FIG. 5, a flowchart of a data caching method provided in Embodiment 3 of the present application is shown in the following:
步骤S501,若目标变量数据的类型为Object,则获取所述目标变量数据的地址,根据所述地址计算所述目标变量数据的哈希码,所述目标变量数据为各个变量数据中的任意一个变量数据。Step S501: If the type of the target variable data is Object, acquire an address of the target variable data, and calculate a hash code of the target variable data according to the address, where the target variable data is any one of the variable data. Variable data.
步骤S502,若所述目标变量数据的类型为String,则获取所述目标变量数据中包含的字符串,根据所述字符串计算所述目标变量数据的哈希码。Step S502, if the type of the target variable data is String, acquire a character string included in the target variable data, and calculate a hash code of the target variable data according to the character string.
步骤S503,若所述目标变量数据的类型为Integer,则获取所述目标变量数据中包含的数字,根据所述数字计算所述目标变量数据的哈希码。Step S503, if the type of the target variable data is Integer, acquire a number included in the target variable data, and calculate a hash code of the target variable data according to the number.
步骤S504,在计算得到各个变量数据的哈希码后,根据计算得到的哈希码将对应的变量数据存入有序序列中。Step S504, after calculating the hash code of each variable data, storing the corresponding variable data into the ordered sequence according to the calculated hash code.
步骤S505,监测各个变量数据是否执行操作,并在监测到变量数据执行操作时,根据所述操作将执行操作的变量数据的权重增大预设值。In step S505, it is monitored whether the respective variable data performs an operation, and when the variable data execution operation is monitored, the weight of the variable data that performs the operation is increased by a preset value according to the operation.
步骤S506,每隔预设时间获取一次各个变量数据中权重最大的变量数据,将权重最大的变量数据通过表头插入方式插入所述单向链表中。Step S506, the variable data with the largest weight among the variable data is acquired once every preset time, and the variable data with the largest weight is inserted into the singly linked list by means of a header insertion manner.
另外,步骤S505还可以为:监测各个变量数据是否执行操作,并在监测到变量数据执行操作时,根据所述操作将执行操作的变量数据的权重减小预设值。对应的,步骤S506可以为:每隔预设时间获取一次各个变量数据中权重最小的变量数据,将权重最小的变量数据通过表头插入方式插入所述单向链表中。In addition, step S505 may further be: monitoring whether each variable data performs an operation, and when monitoring the variable data to perform an operation, reducing a weight of the variable data of the performing operation according to the operation by a preset value. Correspondingly, step S506 may be: acquiring variable data with the smallest weight among the variable data once every preset time, and inserting the variable data with the smallest weight into the singly linked list by means of a header insertion manner.
实施例四Embodiment 4
对应于上文实施例所述的数据缓存方法,图6示出了本申请实施例提供的数据缓存程序的运行环境示意图。为了便于说明,仅示出了与本实施例相关的部分。Corresponding to the data caching method described in the above embodiment, FIG. 6 is a schematic diagram showing the operating environment of the data caching program provided by the embodiment of the present application. For the convenience of explanation, only the parts related to the present embodiment are shown.
在本实施例中,所述的数据缓存程序600安装并运行于服务器60中。该服务器60可包括,但不仅限于,存储器601和处理器602。图6仅示出了具有组件601-602的服务器60,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。In the present embodiment, the data caching program 600 is installed and runs in the server 60. The server 60 can include, but is not limited to, a memory 601 and a processor 602. Figure 6 shows only server 60 with components 601-602, but it should be understood that not all illustrated components may be implemented and that more or fewer components may be implemented instead.
所述存储器601在一些实施例中可以是所述服务器60的内部存储单元,例如该服务器60的硬盘或内存。所述存储器601在另一些实施例中也可以是所述服务器60的外部存储设备,例如所述服务器60上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器601还可以既包括所述服务器60的内部存储单元也包括外部存储设备。所述存储器601用于存储安装于所述服务器60的应用软件及各类数据,例如所述数据缓存程序600的程序代码等。所述存储器601还可以用于暂时地存储已经输出或者将要输出的数据。The memory 601 may be an internal storage unit of the server 60, such as a hard disk or memory of the server 60, in some embodiments. The memory 601 may also be an external storage device of the server 60 in other embodiments, such as a plug-in hard disk equipped on the server 60, a smart memory card (SMC), and a secure digital number (Secure). Digital, SD) cards, flash cards, etc. Further, the memory 601 may also include both an internal storage unit of the server 60 and an external storage device. The memory 601 is configured to store application software and various types of data installed in the server 60, such as program codes of the data cache program 600, and the like. The memory 601 can also be used to temporarily store data that has been output or is about to be output.
所述处理器602在一些实施例中可以是一中央处理器(Central Processing Unit,CPU),微处理器或其他数据处理芯片,用于运行所述存储器601中存储的程序代码或处理数据,例如执行所述数据缓存程序600等。The processor 602 can be a central processor (Central) in some embodiments A processing unit (CPU), a microprocessor or other data processing chip for running program code or processing data stored in the memory 601, such as executing the data caching program 600 and the like.
还可以包括显示器。所述显示器在一些实施例中可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。所述显示器用于显示在所述服务器60中处理的信息以及用于显示可视化的用户界面,例如应用菜单界面、应用图标界面等。所述服务器60的部件601-602通过系统总线相互通信。A display can also be included. The display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch sensor, or the like in some embodiments. The display is for displaying information processed in the server 60 and a user interface for displaying visualizations, such as an application menu interface, an application icon interface, and the like. The components 601-62 of the server 60 communicate with one another via a system bus.
请参阅图7,是本申请实施例提供的数据缓存程序600的功能模块图。在本实施例中,所述的数据缓存程序600可以被分割成一个或多个模块,所述一个或者多个模块被存储于所述存储器601中,并由一个或多个处理器(本实施例为所述处理器602)所执行,以完成本申请。例如,在图7中,所述的数据缓存程序600可以被分割成变量存储模块701、检测调整模块702和处理模块703。本申请所称的模块是指能够完成特定功能的一系列计算机可读指令指令段,比程序更适合于描述所述数据缓存程序600在所述服务器60中的执行过程。以下描述将具体介绍所述模块701-703的功能。Please refer to FIG. 7 , which is a functional block diagram of a data caching program 600 provided by an embodiment of the present application. In this embodiment, the data caching program 600 may be divided into one or more modules, and the one or more modules are stored in the memory 601 and executed by one or more processors (this implementation) An example is performed by the processor 602) to complete the application. For example, in FIG. 7, the data cache program 600 can be divided into a variable storage module 701, a detection adjustment module 702, and a processing module 703. A module as referred to in this application refers to a series of computer readable instruction instructions that are capable of performing a particular function, and are more suitable than the program to describe the execution of the data caching program 600 in the server 60. The following description will specifically describe the functions of the modules 701-703.
其中,变量存储模块701,用于将各个变量数据存入有序序列中,每个变量数据对应设置有一个权重。The variable storage module 701 is configured to store each variable data in an ordered sequence, and each variable data is correspondingly set with a weight.
检测调整模块702,用于监测各个变量数据是否执行操作,并在监测到变量数据执行操作时,将执行操作的变量数据的权重进行调整The detection adjustment module 702 is configured to monitor whether each variable data performs an operation, and adjust the weight of the variable data that performs the operation when the variable data execution operation is monitored.
处理模块703,用于根据调整后的各个变量数据的权重,将权重满足预设条件的变量数据通过表头插入方式插入单向链表中;其中,所述单向链表具有预设长度。The processing module 703 is configured to insert the variable data whose weight meets the preset condition into the singly linked list according to the weight of the adjusted variable data, wherein the singly linked list has a preset length.
可选的,变量存储模块701可以包括第一计算单元、第二计算单元、第三计算单元和存储单元。Optionally, the variable storage module 701 may include a first calculation unit, a second calculation unit, a third calculation unit, and a storage unit.
所述第一计算单元,用于若目标变量数据的类型为Object,则获取所述目标变量数据的地址,根据所述地址计算所述目标变量数据的哈希码,所述目标变量数据为各个变量数据中的任意一个变量数据。The first calculating unit is configured to acquire an address of the target variable data if the type of the target variable data is Object, and calculate a hash code of the target variable data according to the address, where the target variable data is each Any variable data in the variable data.
所述第二计算单元,用于若所述目标变量数据的类型为String,则获取所述目标变量数据中包含的字符串,根据所述字符串计算所述目标变量数据的哈希码。The second calculating unit is configured to: if the type of the target variable data is a String, acquire a character string included in the target variable data, and calculate a hash code of the target variable data according to the character string.
所述第三计算单元,用于若所述目标变量数据的类型为Integer,则获取所述目标变量数据中包含的数字,根据所述数字计算所述目标变量数据的哈希码。The third calculating unit is configured to: if the type of the target variable data is Integer, acquire a number included in the target variable data, and calculate a hash code of the target variable data according to the number.
所述存储单元,用于在计算得到各个变量数据的哈希码后,根据计算得到的哈希码将对应的变量数据存入有序序列中。The storage unit is configured to store the corresponding variable data into the ordered sequence according to the calculated hash code after calculating the hash code of each variable data.
可选的,监测调整模块702具体用于:Optionally, the monitoring adjustment module 702 is specifically configured to:
在监测到变量数据执行操作时,将执行操作的变量数据的权重增大预设值;或When the variable data is detected to perform an operation, the weight of the variable data on which the operation is performed is increased by a preset value; or
在监测到变量数据执行操作时,根据所述操作将执行操作的变量数据的权重增大预设值。When the variable data execution operation is monitored, the weight of the variable data on which the operation is performed is increased by a preset value according to the operation.
可选的,处理模块703可以包括获取单元和插入单元。Optionally, the processing module 703 can include an obtaining unit and an inserting unit.
所述获取单元,用于每隔预设时间获取一次各个变量数据中权重最大的变量数据。The obtaining unit is configured to acquire variable data with the largest weight among the variable data once every preset time.
所述插入单元,用于将权重最大的变量数据通过表头插入方式插入所述单向链表中。The inserting unit is configured to insert the variable data with the largest weight into the singly linked list by means of a header insertion manner.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。It will be clearly understood by those skilled in the art that, for convenience and brevity of description, only the division of each functional unit and module described above is exemplified. In practical applications, the above functions may be assigned to different functional units according to needs. The module is completed by dividing the internal structure of the device into different functional units or modules to perform all or part of the functions described above. Each functional unit and module in the embodiment may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit, and the integrated unit may be implemented by hardware. Formal implementation can also be implemented in the form of software functional units. In addition, the specific names of the respective functional units and modules are only for the purpose of facilitating mutual differentiation, and are not intended to limit the scope of protection of the present application. For the specific working process of the unit and the module in the foregoing system, reference may be made to the corresponding process in the foregoing method embodiment, and details are not described herein again.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the above embodiments, the descriptions of the various embodiments are different, and the parts that are not detailed or described in the specific embodiments may be referred to the related descriptions of other embodiments.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the various examples described in connection with the embodiments disclosed herein can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the solution. A person skilled in the art can use different methods to implement the described functions for each particular application, but such implementation should not be considered to be beyond the scope of the present application.
在本申请所提供的实施例中,应该理解到,所揭露的装置/服务器和方法,可以通过其它的方式实现。例如,以上所描述的装置/服务器实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。In the embodiments provided by the present application, it should be understood that the disclosed apparatus/server and method may be implemented in other manners. For example, the device/server embodiment described above is merely illustrative. For example, the division of the module or unit is only a logical function division, and the actual implementation may have another division manner, such as multiple units or Components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in electrical, mechanical or other form.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
所述集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,也可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一计算机可读存储介质中,该计算机可读指令在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机可读指令包括计算机可读指令代码,所述计算机可读指令代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机可读指令代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质等。需要说明的是,所述计算机可读介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如在某些司法管辖区,根据立法和专利实践,计算机可读介质不包括电载波信号和电信信号。The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, the present application implements all or part of the processes in the foregoing embodiments, and may also be implemented by computer readable instructions, which may be stored in a computer readable storage medium. The computer readable instructions, when executed by a processor, may implement the steps of the various method embodiments described above. Wherein, the computer readable instructions comprise computer readable instruction code, which may be in the form of source code, an object code form, an executable file or some intermediate form or the like. The computer readable medium can include any entity or device capable of carrying the computer readable instruction code, a recording medium, a USB flash drive, a removable hard drive, a magnetic disk, an optical disk, a computer memory, a read only memory (ROM, Read-Only) Memory), random access memory (RAM, Random) Access Memory), electrical carrier signals, telecommunications signals, and software distribution media. It should be noted that the content contained in the computer readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in a jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, computer readable media Does not include electrical carrier signals and telecommunication signals.
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The above-mentioned embodiments are only used to explain the technical solutions of the present application, and are not limited thereto; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still implement the foregoing embodiments. The technical solutions described in the examples are modified or equivalently replaced with some of the technical features; and the modifications or substitutions do not deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in Within the scope of protection of this application.

Claims (20)

  1. 一种数据缓存方法,其特征在于,包括:A data caching method, comprising:
    将各个变量数据存入有序序列中,每个变量数据对应设置有一个重要程度标识信息;Each variable data is stored in an ordered sequence, and each variable data is correspondingly provided with an importance degree identification information;
    监测各个变量数据是否执行操作,并在监测到变量数据执行操作时,将执行操作的变量数据的重要程度标识信息进行调整;Monitoring whether each variable data performs an operation, and adjusting the importance degree identification information of the variable data of the execution operation when monitoring the variable data execution operation;
    根据调整后的各个变量数据的重要程度标识信息,将重要程度标识信息满足预设条件的变量数据通过表头插入方式插入单向链表中;其中,所述单向链表具有预设长度。The variable data indicating that the importance degree identification information satisfies the preset condition is inserted into the singly linked list by means of the header insertion manner according to the importance degree identification information of the adjusted variable data; wherein the singly linked list has a preset length.
  2. 如权利要求1所述的数据缓存方法,其特征在于,所述将各个变量数据存入有序序列中包括:The data caching method according to claim 1, wherein the storing the variable data in the ordered sequence comprises:
    若目标变量数据的类型为Object,则获取所述目标变量数据的地址,根据所述地址计算所述目标变量数据的哈希码,所述目标变量数据为各个变量数据中的任意一个变量数据;If the type of the target variable data is Object, obtain an address of the target variable data, and calculate a hash code of the target variable data according to the address, where the target variable data is any variable data of each variable data;
    若所述目标变量数据的类型为String,则获取所述目标变量数据中包含的字符串,根据所述字符串计算所述目标变量数据的哈希码;If the type of the target variable data is String, acquiring a character string included in the target variable data, and calculating a hash code of the target variable data according to the character string;
    若所述目标变量数据的类型为Integer,则获取所述目标变量数据中包含的数字,根据所述数字计算所述目标变量数据的哈希码;If the type of the target variable data is Integer, acquiring a number included in the target variable data, and calculating a hash code of the target variable data according to the number;
    在计算得到各个变量数据的哈希码后,根据计算得到的哈希码将对应的变量数据存入有序序列中。After the hash code of each variable data is calculated, the corresponding hash data is stored in the ordered sequence according to the calculated hash code.
  3. 如权利要求1所述的数据缓存方法,其特征在于,所述重要程度标识信息包括权重;所述在监测到变量数据执行操作时,将执行操作的变量数据的重要程度标识信息进行调整包括:The data caching method according to claim 1, wherein the importance degree identification information comprises a weight; and when the variable data execution operation is monitored, adjusting the importance degree identification information of the variable data for performing the operation comprises:
    在监测到变量数据执行操作时,将执行操作的变量数据的权重增大预设值。When the variable data execution operation is monitored, the weight of the variable data that performs the operation is increased by a preset value.
  4. 如权利要求1所述的数据缓存方法,其特征在于,所述重要程度标识信息包括权重;所述在监测到变量数据执行操作时,将执行操作的变量数据的权重进行调整包括:The data caching method according to claim 1, wherein the importance degree identification information comprises a weight; and when the variable data execution operation is monitored, adjusting the weight of the variable data for performing the operation comprises:
    在监测到变量数据执行操作时,根据所述操作将执行操作的变量数据的权重增大预设值。When the variable data execution operation is monitored, the weight of the variable data on which the operation is performed is increased by a preset value according to the operation.
  5. 如权利要求1至4任一项所述的数据缓存方法,其特征在于,所述重要程度标识信息包括权重;所述根据调整后的各个变量数据的重要程度标识信息,将重要程度标识信息满足预设条件的变量数据通过表头插入方式插入单向链表中包括:The data caching method according to any one of claims 1 to 4, wherein the importance degree identification information includes a weight; and the importance degree identification information is satisfied according to the adjusted importance degree identification information of each variable data. The variable data of the preset condition is inserted into the singly linked list by means of a header insertion method, including:
    每隔预设时间获取一次各个变量数据中权重最大的变量数据;Obtaining the variable data with the largest weight among the individual variable data every preset time;
    将权重最大的变量数据通过表头插入方式插入所述单向链表中。The variable data with the largest weight is inserted into the singly linked list by means of a header insertion method.
  6. 一种数据缓存装置,其特征在于,包括:A data cache device, comprising:
    变量存储模块,用于将各个变量数据存入有序序列中,每个变量数据对应设置有一个重要程度标识信息;a variable storage module, configured to store each variable data in an ordered sequence, and each variable data is correspondingly set with an importance degree identification information;
    调整模块,用于监测各个变量数据是否执行操作,并在监测到变量数据执行操作时,将执行操作的变量数据的重要程度标识信息进行调整;The adjustment module is configured to monitor whether each variable data performs an operation, and adjust the importance degree identification information of the variable data that performs the operation when the variable data execution operation is monitored;
    插入模块,用于根据调整后的各个变量数据的重要程度标识信息,将重要程度标识信息满足预设条件的变量数据通过表头插入方式插入单向链表中;其中,所述单向链表具有预设长度。The insertion module is configured to insert, according to the adjusted importance degree information of each variable data, the variable data whose importance degree identification information meets the preset condition is inserted into the singly linked list by means of a header insertion manner; wherein the singly linked list has a pre- Set the length.
  7. 如权利要求6所述的数据缓存装置,其特征在于,所述变量存储模块,包括:The data cache device of claim 6, wherein the variable storage module comprises:
    第一哈希码计算模块,用于若目标变量数据的类型为Object,则获取所述目标变量数据的地址,根据所述地址计算所述目标变量数据的哈希码,所述目标变量数据为各个变量数据中的任意一个变量数据;a first hash code calculation module, configured to acquire an address of the target variable data if the type of the target variable data is Object, and calculate a hash code of the target variable data according to the address, where the target variable data is Any one of the variable data;
    第二哈希码计算模块,用若所述目标变量数据的类型为String,则获取所述目标变量数据中包含的字符串,根据所述字符串计算所述目标变量数据的哈希码;a second hash code calculation module, if the type of the target variable data is a String, acquiring a character string included in the target variable data, and calculating a hash code of the target variable data according to the character string;
    第三哈希码计算模块,用若所述目标变量数据的类型为Integer,则获取所述目标变量数据中包含的数字,根据所述数字计算所述目标变量数据的哈希码;a third hash code calculation module, if the type of the target variable data is Integer, acquiring a number included in the target variable data, and calculating a hash code of the target variable data according to the number;
    在计算得到各个变量数据的哈希码后,根据计算得到的哈希码将对应的变量数据存入有序序列中。After the hash code of each variable data is calculated, the corresponding hash data is stored in the ordered sequence according to the calculated hash code.
  8. 如权利要求6所述的数据缓存装置,其特征在于,所述重要程度标识信息包括权重,所述调整模块,包括:The data cache device of claim 6, wherein the importance level identification information comprises a weight, and the adjustment module comprises:
    第一权重增大模块,用于在监测到变量数据执行操作时,将执行操作的变量数据的权重增大预设值。The first weight increasing module is configured to increase a weight of the variable data that performs the operation by a preset value when the variable data is detected to perform an operation.
  9. 如权利要求6所述的数据缓存装置,其特征在于,所述重要程度标识信息包括权重,所述调整模块,还包括:The data cache device of claim 6, wherein the importance level identification information comprises a weight, and the adjusting module further comprises:
    第二权重增大模块,用于在监测到变量数据执行操作时,根据所述操作将执行操作的变量数据的权重增大预设值。And a second weight increasing module, configured to increase a weight of the variable data of the performing operation according to the operation to a preset value when the variable data is monitored.
  10. 如权利要求6至9任意一项所述的数据缓存装置,其特征在于,所述重要程度标识信息包括权重,所述插入模块,包括:The data cache device according to any one of claims 6 to 9, wherein the importance level identification information comprises a weight, and the inserting module comprises:
    变量获取模块,用于每隔预设时间获取一次各个变量数据中权重最大的变量数据;a variable obtaining module, configured to acquire, at a preset time, variable data having the largest weight among the variable data;
    变量插入模块,用于将权重最大的变量数据通过表头插入方式插入所述单向链表中。The variable insertion module is configured to insert the variable data with the largest weight into the singly linked list by means of a header insertion manner.
  11. 一种服务器,其特征在于,所述数据缓存处理服务器包括存储器、处理器,所述存储器上存储有可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:A server, characterized in that the data cache processing server comprises a memory, a processor on which is stored computer readable instructions executable on the processor, the processor executing the computer readable The following steps are implemented when the instruction is executed:
    将各个变量数据存入有序序列中,每个变量数据对应设置有一个重要程度标识信息;Each variable data is stored in an ordered sequence, and each variable data is correspondingly provided with an importance degree identification information;
    监测各个变量数据是否执行操作,并在监测到变量数据执行操作时,将执行操作的变量数据的重要程度标识信息进行调整;Monitoring whether each variable data performs an operation, and adjusting the importance degree identification information of the variable data of the execution operation when monitoring the variable data execution operation;
    根据调整后的各个变量数据的重要程度标识信息,将重要程度标识信息满足预设条件的变量数据通过表头插入方式插入单向链表中;其中,所述单向链表具有预设长度。The variable data indicating that the importance degree identification information satisfies the preset condition is inserted into the singly linked list by means of the header insertion manner according to the importance degree identification information of the adjusted variable data; wherein the singly linked list has a preset length.
  12. 如权利要求11所述的服务器,其特征在于,所述将各个变量数据存入有序序列中包括:The server according to claim 11, wherein said storing said variable data in an ordered sequence comprises:
    若目标变量数据的类型为Object,则获取所述目标变量数据的地址,根据所述地址计算所述目标变量数据的哈希码,所述目标变量数据为各个变量数据中的任意一个变量数据;If the type of the target variable data is Object, obtain an address of the target variable data, and calculate a hash code of the target variable data according to the address, where the target variable data is any variable data of each variable data;
    若所述目标变量数据的类型为String,则获取所述目标变量数据中包含的字符串,根据所述字符串计算所述目标变量数据的哈希码;If the type of the target variable data is String, acquiring a character string included in the target variable data, and calculating a hash code of the target variable data according to the character string;
    若所述目标变量数据的类型为Integer,则获取所述目标变量数据中包含的数字,根据所述数字计算所述目标变量数据的哈希码;If the type of the target variable data is Integer, acquiring a number included in the target variable data, and calculating a hash code of the target variable data according to the number;
    在计算得到各个变量数据的哈希码后,根据计算得到的哈希码将对应的变量数据存入有序序列中。After the hash code of each variable data is calculated, the corresponding hash data is stored in the ordered sequence according to the calculated hash code.
  13. 如权利要求11所述的服务器,其特征在于,所述重要程度标识信息包括权重;所述在监测到变量数据执行操作时,将执行操作的变量数据的重要程度标识信息进行调整包括:The server according to claim 11, wherein the importance degree identification information includes a weight; and when monitoring the variable data execution operation, adjusting the importance degree identification information of the variable data for performing the operation comprises:
    在监测到变量数据执行操作时,将执行操作的变量数据的权重增大预设值。When the variable data execution operation is monitored, the weight of the variable data that performs the operation is increased by a preset value.
  14. 如权利要求11所述的服务器,其特征在于,所述重要程度标识信息包括权重;所述在监测到变量数据执行操作时,将执行操作的变量数据的权重进行调整包括:The server according to claim 11, wherein the importance degree identification information comprises a weight; and when the variable data execution operation is monitored, adjusting the weight of the variable data for performing the operation comprises:
    在监测到变量数据执行操作时,根据所述操作将执行操作的变量数据的权重增大预设值。When the variable data execution operation is monitored, the weight of the variable data on which the operation is performed is increased by a preset value according to the operation.
  15. 如权利要求11至14任一项所述的服务器,其特征在于,所述重要程度标识信息包括权重;所述根据调整后的各个变量数据的重要程度标识信息,将重要程度标识信息满足预设条件的变量数据通过表头插入方式插入单向链表中包括:The server according to any one of claims 11 to 14, wherein the importance degree identification information includes a weight; and the importance degree identification information satisfies a preset according to the adjusted importance degree identification information of each variable data. Conditional variable data is inserted into the singly linked list by means of header insertion:
    每隔预设时间获取一次各个变量数据中权重最大的变量数据;Obtaining the variable data with the largest weight among the individual variable data every preset time;
    将权重最大的变量数据通过表头插入方式插入所述单向链表中。The variable data with the largest weight is inserted into the singly linked list by means of a header insertion method.
  16. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,其特征在于,所述计算机可读指令被至少一个处理器执行时实现如下步骤:A computer readable storage medium storing computer readable instructions, wherein the computer readable instructions, when executed by at least one processor, implement the following steps:
    将各个变量数据存入有序序列中,每个变量数据对应设置有一个重要程度标识信息;Each variable data is stored in an ordered sequence, and each variable data is correspondingly provided with an importance degree identification information;
    监测各个变量数据是否执行操作,并在监测到变量数据执行操作时,将执行操作的变量数据的重要程度标识信息进行调整;Monitoring whether each variable data performs an operation, and adjusting the importance degree identification information of the variable data of the execution operation when monitoring the variable data execution operation;
    根据调整后的各个变量数据的重要程度标识信息,将重要程度标识信息满足预设条件的变量数据通过表头插入方式插入单向链表中;其中,所述单向链表具有预设长度。The variable data indicating that the importance degree identification information satisfies the preset condition is inserted into the singly linked list by means of the header insertion manner according to the importance degree identification information of the adjusted variable data; wherein the singly linked list has a preset length.
  17. 如权利要求16所述的计算机可读存储介质,其特征在于,所述将各个变量数据存入有序序列中包括:The computer readable storage medium of claim 16 wherein said storing said variable data in an ordered sequence comprises:
    若目标变量数据的类型为Object,则获取所述目标变量数据的地址,根据所述地址计算所述目标变量数据的哈希码,所述目标变量数据为各个变量数据中的任意一个变量数据;If the type of the target variable data is Object, obtain an address of the target variable data, and calculate a hash code of the target variable data according to the address, where the target variable data is any variable data of each variable data;
    若所述目标变量数据的类型为String,则获取所述目标变量数据中包含的字符串,根据所述字符串计算所述目标变量数据的哈希码;If the type of the target variable data is String, acquiring a character string included in the target variable data, and calculating a hash code of the target variable data according to the character string;
    若所述目标变量数据的类型为Integer,则获取所述目标变量数据中包含的数字,根据所述数字计算所述目标变量数据的哈希码;If the type of the target variable data is Integer, acquiring a number included in the target variable data, and calculating a hash code of the target variable data according to the number;
    在计算得到各个变量数据的哈希码后,根据计算得到的哈希码将对应的变量数据存入有序序列中。After the hash code of each variable data is calculated, the corresponding hash data is stored in the ordered sequence according to the calculated hash code.
  18. 如权利要求16所述的计算机可读存储介质,其特征在于,所述重要程度标识信息包括权重;所述在监测到变量数据执行操作时,将执行操作的变量数据的重要程度标识信息进行调整包括:The computer readable storage medium according to claim 16, wherein the importance degree identification information comprises a weight; and the monitoring of the change of the importance level identification information of the variable data of the operation is performed when the variable data execution operation is monitored include:
    在监测到变量数据执行操作时,将执行操作的变量数据的权重增大预设值。When the variable data execution operation is monitored, the weight of the variable data that performs the operation is increased by a preset value.
  19. 如权利要求16所述的计算机可读存储介质,其特征在于,所述重要程度标识信息包括权重;所述在监测到变量数据执行操作时,将执行操作的变量数据的权重进行调整包括:The computer readable storage medium according to claim 16, wherein the importance degree identification information comprises a weight; and when the variable data execution operation is monitored, adjusting the weight of the variable data for performing the operation comprises:
    在监测到变量数据执行操作时,根据所述操作将执行操作的变量数据的权重增大预设值。When the variable data execution operation is monitored, the weight of the variable data on which the operation is performed is increased by a preset value according to the operation.
  20. 如权利要求16至19任一项所述的计算机可读存储介质,其特征在于,所述重要程度标识信息包括权重;所述根据调整后的各个变量数据的重要程度标识信息,将重要程度标识信息满足预设条件的变量数据通过表头插入方式插入单向链表中包括:The computer readable storage medium according to any one of claims 16 to 19, wherein the importance degree identification information comprises a weight; the importance level identification information according to the adjusted importance level data of each variable data The variable data whose information meets the preset condition is inserted into the singly linked list through the header insertion method, including:
    每隔预设时间获取一次各个变量数据中权重最大的变量数据;Obtaining the variable data with the largest weight among the individual variable data every preset time;
    将权重最大的变量数据通过表头插入方式插入所述单向链表中。The variable data with the largest weight is inserted into the singly linked list by means of a header insertion method.
PCT/CN2018/074849 2017-09-26 2018-01-31 Data caching method and apparatus, server and medium WO2019061978A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710880106.9 2017-09-26
CN201710880106.9A CN107741962B (en) 2017-09-26 2017-09-26 Data caching method and server

Publications (1)

Publication Number Publication Date
WO2019061978A1 true WO2019061978A1 (en) 2019-04-04

Family

ID=61235361

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/074849 WO2019061978A1 (en) 2017-09-26 2018-01-31 Data caching method and apparatus, server and medium

Country Status (2)

Country Link
CN (1) CN107741962B (en)
WO (1) WO2019061978A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102456026A (en) * 2010-10-21 2012-05-16 中国移动通信集团浙江有限公司 Data acquisition device and method
US20130275951A1 (en) * 2012-04-16 2013-10-17 International Business Machines Corporation Race detection for web applications
CN104516823A (en) * 2013-09-30 2015-04-15 华为技术有限公司 Method and device for storing data
CN107179933A (en) * 2017-06-08 2017-09-19 成都未来之门科技有限公司 Dynamic language identification variables method, device, interpretation method and software transplanting method

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100589087C (en) * 2006-08-22 2010-02-10 中兴通讯股份有限公司 General caching method
CN101692229B (en) * 2009-07-28 2012-06-20 武汉大学 Self-adaptive multilevel cache system for three-dimensional spatial data based on data content
CN102932389B (en) * 2011-08-11 2016-06-22 阿里巴巴集团控股有限公司 A kind of request processing method, device and server system
CN102663096B (en) * 2012-04-11 2015-12-16 北京像素软件科技股份有限公司 A kind of method reading data based on Data cache technology
CN103514106B (en) * 2012-06-20 2016-06-22 北京神州泰岳软件股份有限公司 A kind of data cache method
CN104572784A (en) * 2013-10-27 2015-04-29 西安群丰电子信息科技有限公司 Database backup method and system
CN103984736B (en) * 2014-05-21 2017-04-12 西安交通大学 Efficient buffer management method for NAND flash memory database system
WO2016122550A1 (en) * 2015-01-29 2016-08-04 Hewlett Packard Enterprise Development Lp Heap data structure

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102456026A (en) * 2010-10-21 2012-05-16 中国移动通信集团浙江有限公司 Data acquisition device and method
US20130275951A1 (en) * 2012-04-16 2013-10-17 International Business Machines Corporation Race detection for web applications
CN104516823A (en) * 2013-09-30 2015-04-15 华为技术有限公司 Method and device for storing data
CN107179933A (en) * 2017-06-08 2017-09-19 成都未来之门科技有限公司 Dynamic language identification variables method, device, interpretation method and software transplanting method

Also Published As

Publication number Publication date
CN107741962B (en) 2020-09-29
CN107741962A (en) 2018-02-27

Similar Documents

Publication Publication Date Title
WO2019114128A1 (en) Block chain transaction block processing method, electronic device and readable storage medium
CN107526964B (en) Secure data aggregation and business intelligence for network applications
US9280474B2 (en) Adaptive data prefetching
US10152420B2 (en) Multi-way set associative cache and processing method thereof
WO2021036370A1 (en) Method and device for pre-reading file page, and terminal device
US10795870B1 (en) Schema based validation of extra fields in a data file
CN108984553B (en) Caching method and device
US10657172B2 (en) Method and apparatus for managing image metadata
AU2013100369A4 (en) Unique device authentication among large populations of homogeneous devices
US10664481B2 (en) Computer system programmed to identify common subsequences in logs
CN109240613A (en) Data cache method, device, computer equipment and storage medium
US10069779B2 (en) Method of hybrid message passing with shared memory
CA3043127C (en) Data prefetching method, apparatus, and system
WO2019085307A1 (en) Data sampling method, terminal, and device, and computer readable storage medium
US11782761B2 (en) Resource management unit for capturing operating system configuration states and offloading tasks
US9619859B2 (en) Techniques for efficient GPU triangle list adjacency detection and handling
CN109446225A (en) Data cache method, device, computer equipment and storage medium
JP2022137281A (en) Data query method, device, electronic device, storage medium, and program
US20140379995A1 (en) Semiconductor device for controlling prefetch operation
JP2017510902A (en) Method and apparatus for reducing bandwidth and power in a cache using reads with invalidation
CN104750444A (en) Adaptive partial screen update with dynamic backlight control capability
WO2019061978A1 (en) Data caching method and apparatus, server and medium
RU2635255C2 (en) System coherent cache with possibility of fragmentation/ defragmentation
US11593014B2 (en) System and method for approximating replication completion time
US11275840B2 (en) Management of taint information attached to strings

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSAUNT TO RULE 112(1) EPC

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

Ref document number: 18862917

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 18862917

Country of ref document: EP

Kind code of ref document: A1