Data caching method, apparatus, device, and computer-readable storage medium
By generating user types and hot data, and combining the timestamp mechanism of the cached linked list, the problem of cached data not meeting user needs in existing technologies is solved, and more efficient customized cache processing is achieved.
Patent Information
- Application Number
- CN202310786082.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-29
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2043-06-29
AI Technical Summary
Existing data caching methods ignore the differences in user operation objects, resulting in cached data that does not meet user needs and cached data that is fixed and highly complex.
User types are generated by monitoring user information, hotspot data is generated by combining historical access records, and data cache linked lists are used to perform cache processing based on cache timestamps to generate customized data to be cached.
It improves the customization level of cached data, reduces the complexity of cache operations, and ensures that cached data meets the actual needs of users.
Smart Images

Figure CN116842290B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of financial technology data processing, and in particular to a data caching method and device, an electronic device and a computer readable storage medium. BACKGROUND
[0002] Financial enterprises such as banks, securities companies, trusts, insurance companies, funds and financial leasing usually provide online service platforms or service APPs for users to facilitate business operations, such as member registration, fund transactions, insurance claim reporting, etc.
[0003] When users use the above service platform or service APP, the system usually caches some frequently used business data of the user to quickly respond to the needs of user operation and improve user experience.
[0004] Most of the current cached data is predetermined, and the corresponding cached data is certain when different users access the same business page, that is, the cached data corresponding to the same APP page is fixed. This data caching method ignores the difference between operation objects, and there may be a situation where the pre-cached data is not needed by the user. SUMMARY
[0005] The present application provides a data caching method, device, electronic device and computer readable storage medium, which mainly aims to improve the customization level of data caching in the field of financial data and reduce the complexity of caching operation.
[0006] To achieve the above purpose, the present application provides a data caching method, which comprises:
[0007] When it is monitored that a user accesses a preset page, the user information of the user is obtained, and the user type of the user is generated according to the user information;
[0008] The historical access record of the preset page is obtained, the hot data of the preset page is generated according to the historical access record, and the to-be-cached data is generated according to the user type and the hot data;
[0009] The to-be-cached data is cached by using a preset data caching linked list according to the principle that the earlier the cache timestamp of the cache bit in the data caching linked list, the more front the cache bit.
[0010] Optionally, the user type of the user is generated according to the user information, comprising:
[0011] The text features of the user information are extracted;
[0012] The relative probability value between the text features and the preset user classification label is calculated;
[0013] According to the relative probability value, a score of each user classification label is calculated, and a user classification label with the highest score is taken as the user type of the user.
[0014] Optionally, the text feature of the user information is extracted by:
[0015] segmenting the user information to obtain a segmentation set, and converting each segmentation in the segmentation set into a word vector;
[0016] a text vector matrix of the user information is constructed by using the segmentation set and the word vector of each segmentation;
[0017] a target segmentation is selected from the segmentation set in turn, and a key value of the target segmentation is calculated according to the word vector of the target segmentation and the text vector matrix;
[0018] a preset number of segmentations are selected from the segmentation set in the order from large to small according to the key value as feature segmentations;
[0019] the word vector of the feature segmentation is spliced to obtain the text feature of the user information.
[0020] Optionally, the hot data of the preset page is generated according to the historical access record, including:
[0021] a data unit of user operation is extracted from the historical access record;
[0022] the operation frequency of each data unit is counted;
[0023] a data unit with an operation frequency greater than a preset operation frequency is selected as hot data.
[0024] Optionally, the to-be-cached data is generated according to the user type and the hot data, including:
[0025] a page label of the preset page and a data label set corresponding to the page label are obtained;
[0026] each data unit in the hot data is labeled according to the data label set to obtain a data unit label;
[0027] a mapping relationship between the user type and the data label is obtained, a data unit label corresponding to the user type is obtained, and a data unit corresponding to the data unit label corresponding to the user type is taken as the to-be-cached data.
[0028] Optionally, the step of using a preset data cache linked list and caching the data to be cached according to the principle that the earlier the cache timestamp of the cache position in the data cache linked list, the earlier the cache position is, includes:
[0029] Determine whether the data to be cached is in the preset data cache linked list;
[0030] When the data to be cached is in the data cache linked list, the cache timestamp of the cache bit corresponding to the data to be cached is set to the current time, and the corresponding cache bit is moved to the head of the data cache linked list;
[0031] When the data to be cached is not in the data cache linked list, determine whether the data cache linked list is full;
[0032] When the data cache list is full, release the cached data in the cache slot with the smallest timestamp, move the released cached data to the head of the data cache list, set the cache timestamp to the current time, and store the data to be cached in the released cache slot.
[0033] When the data cache list is not full, randomly select an empty cache slot and move it to the head of the data cache list, set the cache timestamp to the current time, and put the data to be cached into the empty cache slot.
[0034] Optionally, the method further includes: using a preset data cache linked list, and caching the data to be cached according to the principle that the earlier the cache timestamp of the cache position in the data cache linked list, the earlier the cache position.
[0035] When new cached data is added to the preset data cache list, the usage frequency of the cache bit corresponding to the new cached data is incremented by 1;
[0036] When the space in the preset data cache list is full, and the cache bit with the smallest cache timestamp is greater than 1, the space of the cache bit with the lowest usage frequency is released.
[0037] To address the above problems, the present invention also provides a data caching device, the device comprising:
[0038] The cached data customization module is used to detect when a user visits a preset page, obtain the user's user information, generate the user's user type based on the user information, obtain the historical access records of the preset page, generate hotspot data of the preset page based on the historical access records, and generate data to be cached based on the user type and the hotspot data.
[0039] The data caching implementation module is used to cache the data to be cached by using a preset data cache linked list and according to the principle that the earlier the cache timestamp of the cache position in the data cache linked list, the earlier the cache position is.
[0040] To address the above problems, the present invention also provides an electronic device, the electronic device comprising:
[0041] Memory, storing at least one computer program; and
[0042] The processor executes the program stored in the memory to implement the data caching method described above.
[0043] To address the aforementioned problems, the present invention also provides a computer-readable storage medium storing at least one computer program, which is executed by a processor in an electronic device to implement the data caching method described above.
[0044] This invention generates cacheable data based on user type and page hotspot data. On the one hand, user type is related to the user's actual user information, and on the other hand, page hotspot data is related to the page's historical access records. Therefore, the final generated cacheable data is not static, but customized based on actual user information and page historical access data. This operation avoids too much cached data and static cached data, improving the customization level of cached data. At the same time, data is stored based on cache timestamps. Compared with using hash tables to maintain cache state, this application can reduce the complexity of cache operations. Attached Figure Description
[0045] Figure 1 This is a flowchart illustrating a data caching method according to an embodiment of the present invention.
[0046] Figure 2 A detailed implementation flowchart of one step of a data caching method provided in an embodiment of the present invention is shown below;
[0047] Figure 3 A detailed implementation flowchart of one step of a data caching method provided in an embodiment of the present invention is shown below;
[0048] Figure 4 A detailed implementation flowchart of one step of the data caching method provided in an embodiment of the present invention is shown below;
[0049] Figure 5 This is a functional block diagram of a data caching device provided in an embodiment of the present invention;
[0050] Figure 6This is a schematic diagram of the structure of an electronic device that implements the data caching method according to an embodiment of the present invention.
[0051] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0052] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0053] This application provides a data caching method. The execution subject of the data caching method includes, but is not limited to, at least one of electronic devices, such as a server or a terminal, that can be configured to execute the method provided in this application. In other words, the data caching method can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0054] Reference Figure 1 The diagram shown is a flowchart illustrating a data caching method provided in an embodiment of the present invention.
[0055] In this embodiment, the data caching method includes:
[0056] S1. When a user is detected accessing a preset page, the user information of the user is obtained, and the user type of the user is generated based on the user information;
[0057] In this embodiment of the invention, the preset page refers to the page of an online service platform or service APP provided to users by financial enterprises such as banks, securities companies, trusts, insurance companies, funds, and financial leasing companies. Users can browse or operate the preset page to inquire about and handle related business. For example, registering an account, activating automatic trading of a certain fund, or inquiring about insurance returns.
[0058] In this embodiment of the invention, the user information may be the user's financial product attribute information, such as insurance business user, fund business user, bank savings user, etc.; it may be the user's basic personal information, such as age, occupation, gender, etc.; or it may be the user's purchase or transaction records of financial products within a preset time period.
[0059] It should be noted that the user information mentioned is user-authorized information that can be collected.
[0060] It's understandable that different users have different operational tendencies when using different financial product apps or different pages within the same app, and they focus on different business data. For example, insurance users focus on insurance-related services, while fund users focus on fund-related services. A user who has recently browsed a particular fund product will focus on different data when browsing the related pages of that financial product again compared to a user browsing the related pages for the first time.
[0061] In this embodiment of the invention, the purpose of generating the user type based on the user information is to support the same preset page, which can achieve differentiation and customization compared to cached data of different user types.
[0062] For details, please refer to Figure 2 As shown, generating the user type based on the user information includes:
[0063] S11. Extract the text features of the user information;
[0064] In this embodiment of the invention, the user information is text content expressed in natural language. Directly analyzing this user information would consume significant computing resources, resulting in low efficiency. Therefore, NLP (Natural Language Processing) technology can be used to convert the user information into text features. These text features include, but are not limited to, keyword features and financial business attribute features corresponding to the user information.
[0065] For details, please refer to Figure 3 As shown, the extraction of text features from the user information includes:
[0066] S111. The user information is segmented into words to obtain a word segmentation set, and each word segmentation in the word segmentation set is converted into a word vector.
[0067] S112. Using the word segmentation set and the word vector of each word segment, construct the text vector matrix of the user information;
[0068] S113. Select one of the word segments as the target word segment in sequence, and calculate the key value of the target word segment based on the word vector of the target word segment and the text vector matrix;
[0069] S114. Select a preset number of word segments from the word segmentation set as feature words according to the order of the key values from largest to smallest;
[0070] S115. Concatenate the word vectors of the feature segmentation to obtain the text features of the user information.
[0071] In this embodiment of the invention, methods such as Glove (Global Vectors for Word Representation) and Embedding Layer can be used to convert the word vectors of each segmented word into a text vector matrix.
[0072] It is understood that not every word in the word segmentation set represents a textual feature of the user information. Therefore, the word segmentation set needs to be filtered. In this embodiment of the invention, one word is selected from the word segmentation set as the target word. The key value of the target word is calculated based on its word vector and the text vector matrix. The key value is then used to filter out representative feature words in the user information, thereby obtaining the textual features of the user information.
[0073] In this embodiment of the invention, the key value of the target word segmentation can be calculated using the following key value algorithm:
[0074]
[0075] Where K is the key value, |W T | represents the modulus of the transpose of the text vector matrix. The modulus of the word vectors of the target word segmentation.
[0076] S12. Calculate the relative probability value between the text features and the preset user classification labels;
[0077] S13. Calculate the score of each user category tag based on the relative probability value, and take the user category tag with the highest score as the user type of the user.
[0078] In this embodiment of the invention, the preset user classification tags can be set according to actual business needs. For example, they can be set according to the user's business attributes, and the user classification tags can include insurance business users, fund business users, etc., and can be further subdivided, such as auto insurance business users, life insurance business users, etc. Alternatively, they can be set according to the user's historical transaction records, and the user classification tags can be low-potential business users, medium-potential business users, and high-potential business users.
[0079] In this embodiment of the invention, the relative probability value between the text features and the preset user classification labels can be calculated using a pre-trained activation function, wherein the pre-trained activation function includes, but is not limited to, the softmax activation function, the sigmoid activation function, and the ReLU activation function.
[0080] S2. Obtain the historical access records of the preset page, generate hotspot data of the preset page based on the historical access records, and generate data to be cached based on the user type and the hotspot data;
[0081] In this embodiment of the invention, the historical access record refers to the operation record of a user accessing the preset page within a preset time period. For example, within six months, the preset page has accumulated tens of thousands of access records. The access record includes, but is not limited to, input data operations, query data operations, and delete data operations that occur on the preset page.
[0082] In this embodiment of the invention, the hotspot data refers to high-frequency operation data obtained by statistical analysis based on the historical access records.
[0083] Specifically, generating the hotspot data for the preset page based on the historical access records includes:
[0084] Extract user operation data units from the historical access records;
[0085] The operation frequency of each data unit is statistically analyzed.
[0086] Data units whose operation frequency is greater than a preset operation frequency are selected as hot data.
[0087] In this embodiment of the invention, the data unit refers to the smallest data object operated by the user, such as a registered member ID, a newly purchased fund brand, or a transaction amount.
[0088] In this embodiment of the invention, the preset operation frequency can be set according to the actual business situation.
[0089] In this embodiment of the invention, the formation of hotspot data for the preset page is based on both the data content of the preset page itself and the historical access records of the preset page during actual use. This ensures that the final hotspot data conforms to the historical user operations and guarantees the accuracy of the hotspot data.
[0090] Furthermore, in this embodiment of the invention, the user type and hotspot data of the preset page are combined to generate the final data to be cached. On the one hand, the user type is related to the actual user information, and on the other hand, the page hotspot data is related to the page's historical access records. Therefore, the final generated data to be cached is not static, but customized based on the actual user information and the page's historical access data. This operation avoids too much cached data and static cached data, and improves the customization level of the cached data.
[0091] For details, please refer to Figure 4As shown, the step of generating cacheable data based on the user type and the hotspot data includes:
[0092] S21. Obtain the page tags of the preset page and the data tag set corresponding to the page tags;
[0093] S22. Tag each data unit in the hot data according to the data tag set to obtain data unit tags;
[0094] S23. Based on the preset mapping relationship between user type and data tag, obtain the data unit tag corresponding to the user type, and use the data unit corresponding to the data unit tag corresponding to the user type as the data to be cached.
[0095] In this embodiment of the invention, the preset page tags refer to custom tags that differentiate each preset page according to actual business conditions, such as user registration tags, fund transaction tags, and car insurance claims tags.
[0096] In this embodiment of the invention, the data tag set corresponding to the page tag refers to the data tag set obtained by dividing the text content of the preset page in advance according to the page tag of each preset page. For example, if the page tag of a certain preset page is the car insurance claim tag, the data tag set corresponding to the preset page includes, but is not limited to, data tags such as vehicle model, vehicle insurance type, and vehicle accident type.
[0097] In this embodiment of the invention, the preset mapping relationship between user type and data tag refers to the correspondence between user type and data tag set in advance according to actual business conditions. For example, if the user type is a car insurance business user, the corresponding data tag includes vehicle model, vehicle insurance type, vehicle accident type, etc.
[0098] S3. Using a preset data cache linked list, the data to be cached is cached according to the principle that the earlier the cache timestamp of the cache position in the data cache linked list, the earlier the cache position is.
[0099] In this embodiment of the invention, the preset data cache linked list is a doubly linked list, and each cache bit can adopt a bitmap structure. Initially, the cache timestamp corresponding to each cache bit in the preset data cache linked list is 0. When data is written to a cache bit in the data cache linked list, the timestamp of the corresponding cache bit is updated to the current time. As data is continuously written or deleted, the timestamp of each cache bit in the preset data cache linked list displays a different time.
[0100] In this embodiment of the invention, based on the common LRU (Least Recently Used) algorithm, the data to be cached is cached according to the principle that the earlier the cache timestamp of the cache position in the data cache list, the earlier the cache position is.
[0101] Specifically, S3 includes:
[0102] Determine whether the data to be cached is in the preset data cache linked list;
[0103] When the data to be cached is in the data cache linked list, the cache timestamp of the cache bit corresponding to the data to be cached is set to the current time, and the corresponding cache bit is moved to the head of the data cache linked list;
[0104] When the data to be cached is not in the data cache linked list, determine whether the data cache linked list is full;
[0105] When the data cache list is full, release the cached data in the cache slot with the smallest timestamp, move the released cached data to the head of the data cache list, set the cache timestamp to the current time, and store the data to be cached in the released cache slot.
[0106] When the data cache list is not full, randomly select an empty cache slot and move it to the head of the data cache list, set the cache timestamp to the current time, and put the data to be cached into the empty cache slot.
[0107] In this embodiment of the invention, the cache bits in the preset data cache linked list are stored and cleared by using the early and late cache timestamps of the cache bits. Compared with using a hash table to maintain the cache state, this application can reduce the complexity of cache operations.
[0108] In another optional embodiment of the present invention, data usage frequency recording information may be added to each cache bit to prevent the situation where cached data in multiple cache bits with the same timestamp cannot be cleared.
[0109] For example, the following method can be used to resolve the situation where cached data with multiple cache bits having the same timestamp cannot be cleared:
[0110] When new cached data is added to the preset data cache list, the usage frequency of the cache bit corresponding to the new cached data is incremented by 1;
[0111] When the space in the preset data cache list is full, and the cache bit with the smallest cache timestamp is greater than 1, the space of the cache bit with the lowest usage frequency is released.
[0112] This invention generates cacheable data based on user type and page hotspot data. On the one hand, user type is related to the user's actual user information, and on the other hand, page hotspot data is related to the page's historical access records. Therefore, the final generated cacheable data is not static, but customized based on actual user information and page historical access data. This operation avoids too much cached data and static cached data, improving the customization level of cached data. At the same time, data is stored based on cache timestamps. Compared with using hash tables to maintain cache state, this application can reduce the complexity of cache operations.
[0113] like Figure 5 The diagram shown is a functional block diagram of a data caching device provided in an embodiment of the present invention.
[0114] The data caching device 100 of the present invention can be installed in an electronic device. Depending on the functions implemented, the data caching device 100 includes a cached data customization module 101 and a data caching implementation module 102. The module in this invention can also be called a unit, which refers to a series of computer program segments that can be executed by the processor of an electronic device and can perform a fixed function, and which are stored in the memory of the electronic device.
[0115] In this embodiment, the functions of each module / unit are as follows:
[0116] The cache data customization module 101 is used to detect when a user accesses a preset page, obtain the user information of the user, generate the user type of the user based on the user information, obtain the historical access records of the preset page, generate hotspot data of the preset page based on the historical access records, and generate data to be cached based on the user type and the hotspot data.
[0117] The data caching implementation module 102 is used to cache the data to be cached by using a preset data cache linked list, based on the principle that the earlier the cache timestamp of the cache position in the data cache linked list, the earlier the cache position is.
[0118] In detail, the specific implementation methods of each module of the data caching device 100 are as follows:
[0119] Step 1: When a user visits a preset page, obtain the user's user information and generate the user's user type based on the user information;
[0120] In this embodiment of the invention, the preset page refers to the page of an online service platform or service APP provided to users by financial enterprises such as banks, securities companies, trusts, insurance companies, funds, and financial leasing companies. Users can browse or operate the preset page to inquire about and handle related business. For example, registering an account, activating automatic trading of a certain fund, or inquiring about insurance returns.
[0121] In this embodiment of the invention, the user information may be the user's financial product attribute information, such as insurance business user, fund business user, bank savings user, etc.; it may be the user's basic personal information, such as age, occupation, gender, etc.; or it may be the user's purchase or transaction records of financial products within a preset time period.
[0122] It should be noted that the user information mentioned is user-authorized information that can be collected.
[0123] It's understandable that different users have different operational tendencies when using different financial product apps or different pages within the same app, and they focus on different business data. For example, insurance users focus on insurance-related services, while fund users focus on fund-related services. A user who has recently browsed a particular fund product will focus on different data when browsing the related pages of that financial product again compared to a user browsing the related pages for the first time.
[0124] In this embodiment of the invention, the purpose of generating the user type based on the user information is to support the same preset page, which can achieve differentiation and customization compared to cached data of different user types.
[0125] Specifically, generating the user type based on the user information includes:
[0126] Step A: Extract the text features of the user information;
[0127] In this embodiment of the invention, the user information is text content expressed in natural language. Directly analyzing this user information would consume significant computing resources, resulting in low efficiency. Therefore, NLP (Natural Language Processing) technology can be used to convert the user information into text features. These text features include, but are not limited to, keyword features and financial business attribute features corresponding to the user information.
[0128] Specifically, the extraction of text features from the user information includes:
[0129] The user information is segmented into words to obtain a word segmentation set, and each word segmentation in the word segmentation set is converted into a word vector.
[0130] Using the word segmentation set and the word vector of each word segment, a text vector matrix of the user information is constructed;
[0131] Select one of the word segments in sequence as the target word segment, and calculate the key value of the target word segment based on the word vector of the target word segment and the text vector matrix;
[0132] A preset number of word segments are selected from the word segmentation set as feature words according to the order of the key values from largest to smallest.
[0133] The text features of the user information are obtained by concatenating the word vectors of the feature segmentation.
[0134] In this embodiment of the invention, methods such as Glove (Global Vectors for Word Representation) and Embedding Layer can be used to convert the word vectors of each segmented word into a text vector matrix.
[0135] It is understood that not every word in the word segmentation set represents a textual feature of the user information. Therefore, the word segmentation set needs to be filtered. In this embodiment of the invention, one word is selected from the word segmentation set as the target word. The key value of the target word is calculated based on its word vector and the text vector matrix. The key value is then used to filter out representative feature words in the user information, thereby obtaining the textual features of the user information.
[0136] In this embodiment of the invention, the key value of the target word segmentation can be calculated using the following key value algorithm:
[0137]
[0138] Where K is the key value, |W T | represents the modulus of the transpose of the text vector matrix. The modulus of the word vectors of the target word segmentation.
[0139] Step B: Calculate the relative probability values between the text features and the preset user classification labels;
[0140] Step C: Calculate the score of each user category tag based on the relative probability value, and take the user category tag with the highest score as the user type of the user.
[0141] In this embodiment of the invention, the preset user classification tags can be set according to actual business needs. For example, they can be set according to the user's business attributes, and the user classification tags can include insurance business users, fund business users, etc., and can be further subdivided, such as auto insurance business users, life insurance business users, etc. Alternatively, they can be set according to the user's historical transaction records, and the user classification tags can be low-potential business users, medium-potential business users, and high-potential business users.
[0142] In this embodiment of the invention, the relative probability value between the text features and the preset user classification labels can be calculated using a pre-trained activation function, wherein the pre-trained activation function includes, but is not limited to, the softmax activation function, the sigmoid activation function, and the ReLU activation function.
[0143] Step 2: Obtain the historical access records of the preset page, generate hotspot data for the preset page based on the historical access records, and generate data to be cached based on the user type and the hotspot data;
[0144] In this embodiment of the invention, the historical access record refers to the operation record of a user accessing the preset page within a preset time period. For example, within six months, the preset page has accumulated tens of thousands of access records. The access record includes, but is not limited to, input data operations, query data operations, and delete data operations that occur on the preset page.
[0145] In this embodiment of the invention, the hotspot data refers to high-frequency operation data obtained by statistical analysis based on the historical access records.
[0146] Specifically, generating the hotspot data for the preset page based on the historical access records includes:
[0147] Extract user operation data units from the historical access records;
[0148] The operation frequency of each data unit is statistically analyzed.
[0149] Data units whose operation frequency is greater than a preset operation frequency are selected as hot data.
[0150] In this embodiment of the invention, the data unit refers to the smallest data object operated by the user, such as a registered member ID, a newly purchased fund brand, or a transaction amount.
[0151] In this embodiment of the invention, the preset operation frequency can be set according to the actual business situation.
[0152] In this embodiment of the invention, the formation of hotspot data for the preset page is based on both the data content of the preset page itself and the historical access records of the preset page during actual use. This ensures that the final hotspot data conforms to the historical user operations and guarantees the accuracy of the hotspot data.
[0153] Furthermore, in this embodiment of the invention, the user type and hotspot data of the preset page are combined to generate the final data to be cached. On the one hand, the user type is related to the actual user information, and on the other hand, the page hotspot data is related to the page's historical access records. Therefore, the final generated data to be cached is not static, but customized based on the actual user information and the page's historical access data. This operation avoids too much cached data and static cached data, and improves the customization level of the cached data.
[0154] Specifically, generating the data to be cached based on the user type and the hotspot data includes:
[0155] Obtain the page tags of the preset page and the data tag set corresponding to the page tags;
[0156] Each data unit in the hot data is labeled according to the data label set to obtain a data unit label;
[0157] Based on the preset mapping relationship between user types and data tags, the data unit tag corresponding to the user type is obtained, and the data unit corresponding to the data unit tag corresponding to the user type is used as the data to be cached.
[0158] In this embodiment of the invention, the preset page tags refer to custom tags that differentiate each preset page according to actual business conditions, such as user registration tags, fund transaction tags, and car insurance claims tags.
[0159] In this embodiment of the invention, the data tag set corresponding to the page tag refers to the data tag set obtained by dividing the text content of the preset page in advance according to the page tag of each preset page. For example, if the page tag of a certain preset page is the car insurance claim tag, the data tag set corresponding to the preset page includes, but is not limited to, data tags such as vehicle model, vehicle insurance type, and vehicle accident type.
[0160] In this embodiment of the invention, the preset mapping relationship between user type and data tag refers to the correspondence between user type and data tag set in advance according to actual business conditions. For example, if the user type is a car insurance business user, the corresponding data tag includes vehicle model, vehicle insurance type, vehicle accident type, etc.
[0161] Step 3: Using a preset data cache linked list, the data to be cached is cached according to the principle that the earlier the cache timestamp of the cache position in the data cache linked list, the earlier the cache position is.
[0162] In this embodiment of the invention, the preset data cache linked list is a doubly linked list, and each cache bit can adopt a bitmap structure. Initially, the cache timestamp corresponding to each cache bit in the preset data cache linked list is 0. When data is written to a cache bit in the data cache linked list, the timestamp of the corresponding cache bit is updated to the current time. As data is continuously written or deleted, the timestamp of each cache bit in the preset data cache linked list displays a different time.
[0163] In this embodiment of the invention, based on the common LRU (Least Recently Used) algorithm, the data to be cached is cached according to the principle that the earlier the cache timestamp of the cache position in the data cache list, the earlier the cache position is.
[0164] In detail, the caching process for the data to be cached, based on the principle that the earlier the cache timestamp of the cache position in the data cache linked list, the earlier the cache position, includes:
[0165] Determine whether the data to be cached is in the preset data cache linked list;
[0166] When the data to be cached is in the data cache linked list, the cache timestamp of the cache bit corresponding to the data to be cached is set to the current time, and the corresponding cache bit is moved to the head of the data cache linked list;
[0167] When the data to be cached is not in the data cache linked list, determine whether the data cache linked list is full;
[0168] When the data cache list is full, release the cached data in the cache slot with the smallest timestamp, move the released cached data to the head of the data cache list, set the cache timestamp to the current time, and store the data to be cached in the released cache slot.
[0169] When the data cache list is not full, randomly select an empty cache slot and move it to the head of the data cache list, set the cache timestamp to the current time, and put the data to be cached into the empty cache slot.
[0170] In this embodiment of the invention, the cache bits in the preset data cache linked list are stored and cleared by using the early and late cache timestamps of the cache bits. Compared with using a hash table to maintain the cache state, this application can reduce the complexity of cache operations.
[0171] In another optional embodiment of the present invention, data usage frequency recording information may be added to each cache bit to prevent the situation where cached data in multiple cache bits with the same timestamp cannot be cleared.
[0172] For example, the following method can be used to resolve the situation where cached data with multiple cache bits having the same timestamp cannot be cleared:
[0173] When new cached data is added to the preset data cache list, the usage frequency of the cache bit corresponding to the new cached data is incremented by 1;
[0174] When the space in the preset data cache list is full, and the cache bit with the smallest cache timestamp is greater than 1, the space of the cache bit with the lowest usage frequency is released.
[0175] This invention generates cacheable data based on user type and page hotspot data. On the one hand, user type is related to the user's actual user information, and on the other hand, page hotspot data is related to the page's historical access records. Therefore, the final generated cacheable data is not static, but customized based on actual user information and page historical access data. This operation avoids too much cached data and static cached data, improving the customization level of cached data. At the same time, data is stored based on cache timestamps. Compared with using hash tables to maintain cache state, the data caching device provided in this application can reduce the complexity of caching operations.
[0176] like Figure 6 The diagram shown is a structural schematic of an electronic device that implements a data caching method according to an embodiment of the present invention.
[0177] The electronic device 1 may include a processor 10, a memory 11, and a bus, and may also include a computer program, such as a data cache, stored in the memory 11 and executable on the processor 10.
[0178] The memory 11 includes at least one type of readable storage medium, such as flash memory, portable hard drive, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 11 can be an internal storage unit of the electronic device 1, such as a portable hard drive. In other embodiments, the memory 11 can be an external storage device of the electronic device 1, such as a plug-in portable hard drive, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on the electronic device 1. Furthermore, the memory 11 can include both internal and external storage units of the electronic device 1. The memory 11 can be used not only to store application software and various types of data installed on the electronic device 1, such as cached code, but also to temporarily store data that has been output or will be output.
[0179] In some embodiments, the processor 10 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits with the same or different functions, including combinations of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 10 is the control unit of the electronic device, connecting various components of the entire electronic device through various interfaces and lines. It executes programs or modules (e.g., data caches) stored in the memory 11 by running or executing them, and by calling data stored in the memory 11, to perform various functions of the electronic device 1 and process data.
[0180] The bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into an address bus, a data bus, a control bus, etc. The bus is configured to enable communication between the memory 11 and at least one processor 10, etc.
[0181] Figure 6 Only electronic devices with components are shown; it will be understood by those skilled in the art that... Figure 6 The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown, or combine certain components, or have different component arrangements.
[0182] For example, although not shown, the electronic device 1 may also include a power supply (such as a battery) to power various components. Preferably, the power supply can be logically connected to the at least one processor 10 through a power management device, thereby enabling functions such as charging management, discharging management, and power consumption management. The power supply may also include one or more DC or AC power supplies, recharging devices, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device 1 may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be described in detail here.
[0183] Furthermore, the electronic device 1 may also include a network interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a Wi-Fi interface, a Bluetooth interface, etc.), which is typically used to establish communication connections between the electronic device 1 and other electronic devices.
[0184] Optionally, the electronic device 1 may further include a user interface, which may be a display, an input unit (such as a keyboard), or a standard wired or wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the electronic device 1 and to display a visual user interface.
[0185] It should be understood that the embodiments described are for illustrative purposes only and are not limited to this structure in the scope of the patent application.
[0186] The data cache stored in the memory 11 of the electronic device 1 is a combination of multiple instructions, which, when run in the processor 10, can achieve the following:
[0187] When a user is detected accessing a preset page, the user's user information is obtained, and the user's user type is generated based on the user information;
[0188] Obtain the historical access records of the preset page, generate hotspot data of the preset page based on the historical access records, and generate data to be cached based on the user type and the hotspot data;
[0189] Using a pre-defined data cache linked list, the data to be cached is cached according to the principle that the earlier the cache timestamp of the cache position in the data cache linked list, the earlier the cache position is.
[0190] Furthermore, if the modules / units integrated in the electronic device 1 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, or a read-only memory (ROM).
[0191] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor of an electronic device, can perform the following:
[0192] When a user is detected accessing a preset page, the user's user information is obtained, and the user's user type is generated based on the user information;
[0193] Obtain the historical access records of the preset page, generate hotspot data of the preset page based on the historical access records, and generate data to be cached based on the user type and the hotspot data;
[0194] Using a pre-defined data cache linked list, the data to be cached is cached according to the principle that the earlier the cache timestamp of the cache position in the data cache linked list, the earlier the cache position is.
[0195] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.
[0196] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0197] Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within the invention. No appended diagram markings in the claims should be construed as limiting the scope of the claims.
[0198] The blockchain referred to in this invention is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.
[0199] The embodiments of this application can acquire and process relevant data based on holographic projection technology. Artificial Intelligence (AI) is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0200] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in a system claim may also be implemented by a single unit or device through software or hardware. The term "second class" is used to indicate names and does not indicate any specific order.
[0201] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A data caching method, characterized in that, The method includes: When a user is detected accessing a preset page, the user's user information is obtained, and the user's user type is generated based on the user information; Obtain the historical access records of the preset page, generate hotspot data of the preset page based on the historical access records, and generate data to be cached based on the user type and the hotspot data; Using a pre-defined data cache linked list, the data to be cached is cached according to the principle that the earlier the cache timestamp of the cache position in the data cache linked list, the earlier the cache position is. The step of generating hotspot data for the preset page based on the historical access records includes: extracting data units of user operations from the historical access records; calculating the operation frequency of each data unit; and selecting data units whose operation frequency is greater than a preset operation frequency as hotspot data. The step of generating cacheable data based on the user type and the hot data includes: obtaining the page tags of the preset page and the data tag set corresponding to the page tags; tagging each data unit in the hot data according to the data tag set to obtain a data unit tag; obtaining the data unit tag corresponding to the user type according to the preset mapping relationship between user type and data tags; and using the data unit corresponding to the data unit tag corresponding to the user type as the cacheable data.
2. The data caching method as described in claim 1, characterized in that, The step of generating the user type based on the user information includes: Extract the text features of the user information; Calculate the relative probability values between the text features and the preset user classification labels; The score for each user category tag is calculated based on the relative probability value, and the user category tag with the highest score is taken as the user type.
3. The data caching method as described in claim 2, characterized in that, The extraction of text features from the user information includes: The user information is segmented into words to obtain a word segmentation set, and each word segmentation in the word segmentation set is converted into a word vector. Using the word segmentation set and the word vector of each word segment, a text vector matrix of the user information is constructed; Select one of the word segments in sequence as the target word segment, and calculate the key value of the target word segment based on the word vector of the target word segment and the text vector matrix; A preset number of word segments are selected from the word segmentation set as feature words according to the order of the key values from largest to smallest. The text features of the user information are obtained by concatenating the word vectors of the feature segmentation.
4. The data caching method as described in claim 1, characterized in that, The process of caching the data to be cached using a preset data cache linked list, based on the principle that the earlier the cache timestamp of a cached bit in the linked list, the earlier the cached bit is, includes: Determine whether the data to be cached is in the preset data cache linked list; When the data to be cached is in the data cache linked list, the cache timestamp of the cache bit corresponding to the data to be cached is set to the current time, and the corresponding cache bit is moved to the head of the data cache linked list; When the data to be cached is not in the data cache linked list, determine whether the data cache linked list is full; When the data cache list is full, release the cached data in the cache slot with the smallest timestamp, move the released cached data to the head of the data cache list, set the cache timestamp to the current time, and store the data to be cached in the released cache slot. When the data cache list is not full, randomly select an empty cache slot and move it to the head of the data cache list, set the cache timestamp to the current time, and put the data to be cached into the empty cache slot.
5. The data caching method as described in claim 4, characterized in that, The step of using a preset data cache linked list to cache the data to be cached, based on the principle that the earlier the cache timestamp of the cache position in the data cache linked list, the earlier the cache position, further includes: When new cached data is added to the preset data cache list, the usage frequency of the cache bit corresponding to the new cached data is incremented by 1; When the space in the preset data cache list is full, and the cache bit with the smallest cache timestamp is greater than 1, the space of the cache bit with the lowest usage frequency is released.
6. A data caching device for implementing the data caching method as described in any one of claims 1 to 5, characterized in that, The device includes: The cached data customization module is used to detect when a user visits a preset page, obtain the user's user information, generate the user's user type based on the user information, obtain the historical access records of the preset page, generate hotspot data of the preset page based on the historical access records, and generate data to be cached based on the user type and the hotspot data. The data caching implementation module is used to cache the data to be cached by using a preset data cache linked list and according to the principle that the earlier the cache timestamp of the cache position in the data cache linked list, the earlier the cache position is.
7. An electronic device, characterized in that, The electronic device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the data caching method as described in any one of claims 1 to 5.
8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the data caching method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Edge-buffer management method, personal cloud system, and computer readable storage medium
CN109257193A
Film and television member package recommendation method and device
CN113139856A