Recommendation methods, devices, electronic devices, and computer-readable storage media
By storing object identification information and deactivation time information in the Cuckoo Filter, the eligibility of objects for recommendation is dynamically determined, which solves the problem of recommendations not meeting expectations due to changes in user interests, and improves user acceptance and experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NETEASE (HANGZHOU) NETWORK CO LTD
- Filing Date
- 2023-05-22
- Publication Date
- 2026-05-26
AI Technical Summary
In existing technologies, the types of objects that users are interested in are time-sensitive, which makes it impossible for object recommendations to adapt to changes in user interests. As a result, the recommended objects do not meet user expectations, leading to low user acceptance.
A cuckoo filter is used to store the identifier information of objects recommended by users and their delisting time information. The system reads the data to determine whether an object is eligible for re-recommendation and makes a recommendation when the delisting time condition is met.
It achieves dynamic and efficient object recommendation, increases user acceptance of recommended objects, and enhances user experience.
Smart Images

Figure CN116821476B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing, and specifically to an object recommendation method, apparatus, electronic device, and computer-readable storage medium. Background Technology
[0002] As users have more choices, recommending specific items to them is becoming increasingly common. Examples include team recommendations in virtual games, product recommendations on online shopping platforms, and audio or video recommendations.
[0003] In practical applications, to avoid frequently recommending certain objects to users, objects that have been recommended to users are usually filtered out during object recommendation, and objects that have not been recommended to users are recommended to users so that users can choose objects that are of interest.
[0004] However, the types of objects that users are interested in are often time-sensitive. As time goes by, objects that users were not interested in before may become objects that they are interested in now. The above solution obviously cannot adapt to changes in users' interests. Summary of the Invention
[0005] This application provides an object recommendation method, apparatus, electronic device, and computer-readable storage medium, which can dynamically and efficiently recommend objects as they change over time. The specific solution is as follows.
[0006] In a first aspect, embodiments of this application provide an object recommendation method, the method comprising:
[0007] In response to an instruction to determine whether a target object is qualified for recommendation for a target user, the identifier information of the target object is obtained;
[0008] Based on the identification information of the target object, a first storage location is determined in a preset data structure filter. The data structure filter includes multiple storage locations, which are used to store the identification information of the first object that has been recommended to the target user and the deactivation time information for re-recommending the first object.
[0009] Data is read from the first storage location;
[0010] If data is read from the first storage location, and the read data includes the identification information of the target object, and the first release time indicated by the release time information in the read data is less than or equal to the current time, then it is determined that the target object is qualified to be recommended to the target user, and the target object is recommended to the target user.
[0011] Secondly, embodiments of this application provide an object recommendation device, the device comprising:
[0012] The acquisition unit is used to acquire the identification information of the target object in response to an instruction to determine whether the target object is qualified for recommendation for the target user;
[0013] The determining unit is configured to determine a first storage location in a preset data structure filter based on the identification information of the target object, wherein the data structure filter includes multiple storage locations, and the storage locations are used to store the identification information of the first object that has been recommended to the target user and the deactivation time information for re-recommending the first object;
[0014] A reading unit is used to read data from the first storage location;
[0015] The recommendation unit is configured to, when reading data from the first storage location, determine that the target object is qualified to be recommended to the target user if the read data includes the identification information of the target object and the first release time indicated by the release time information in the read data is less than or equal to the current time, and recommend the target object to the target user.
[0016] Thirdly, this application also provides an electronic device, including:
[0017] Processor; and
[0018] A memory for storing a data processing program, which, when the electronic device is powered on and runs through the processor, executes the method described in the first aspect.
[0019] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a data processing program that is executed by a processor to perform the method described in the first aspect.
[0020] Compared with the prior art, this application has the following advantages:
[0021] The object recommendation method provided in this application, in response to an instruction to determine whether a target object is qualified for recommendation to a target user, obtains the identification information of the target object; determines a first storage location in a preset data structure filter based on the identification information of the target object, wherein the data structure filter includes multiple storage locations, the storage locations being used to store the identification information of a first object previously recommended to the target user and deactivation time information for re-recommending the first object; reads data from the first storage location; if, when data is read from the first storage location, the read data includes the identification information of the target object, and the first deactivation time indicated by the deactivation time information in the read data is less than or equal to the current time, then it is determined that the target object is qualified for recommendation to the target user, and the target object is recommended to the target user.
[0022] Since the preset data structure filter stores the identification information and corresponding release time information of the first recommended object, if the target object's identification information is stored in the Cuckoo Filter, its storage location is the first storage location determined in the data structure filter based on the target object's identification information. Thus, when the first storage location stores the target object's identification information, and the first release time indicated by the corresponding release time information is less than or equal to the current time, it means that the target object has reached the set release time for re-recommendation at the current time, and therefore the target object is eligible for re-recommendation. It is evident that the object recommendation method provided in this application can dynamically and efficiently recommend objects over time, thereby increasing user acceptance of the recommended objects and improving the user experience. Attached Figure Description
[0023] Figure 1 This is a flowchart of the object recommendation method provided in the embodiments of this application;
[0024] Figure 2 This is a schematic diagram of the data stored in the data structure filter provided in the embodiments of this application;
[0025] Figure 3 This is a schematic diagram showing the storage location of the release time in the data structure filter provided in this embodiment of the application;
[0026] Figure 4 This is a comparative diagram of the reference time before and after adjustment in the data structure filter provided in the embodiments of this application;
[0027] Figure 5 This is a structural block diagram of an example of the object recommendation device provided in the embodiments of this application;
[0028] Figure 6This is a structural block diagram of an example of an electronic device provided in an embodiment of this application. Detailed Implementation
[0029] Many specific details are set forth in the following description to provide a full understanding of this application. However, this application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this application; therefore, this application is not limited to the specific embodiments disclosed below.
[0030] It should be noted that the terms "first," "second," "third," etc., in the claims, specification, and drawings of this application are used to distinguish similar objects and are not used to describe a specific order or sequence. Such data are interchangeable where appropriate so that the embodiments of this application described herein can be implemented in a sequence other than that shown or described herein. Furthermore, the terms "comprising," "having," and their variations are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products, or apparatuses. Additionally, the term "a plurality" refers to two or more. The "current time" in the claims, specification, and drawings of this application refers to the current time when the step is being performed; for example, the current time in step A refers to the current time when step A is being performed, and the current time in step B refers to the current time when step B is being performed.
[0031] The following provides a further explanation of the existing technology.
[0032] In the field of data processing, recommending objects to users is becoming increasingly common. In practice, to ensure reasonable object recommendations, it's common practice to record object types that users haven't accepted, thus avoiding recommending those types during the recommendation process. However, the types of objects users are interested in are often time-sensitive. By refraining from recommending rejected object types in the above approach, the number of recommended object types available to users decreases, and the recommended objects may not even meet the user's expectations.
[0033] For example, virtual games recommend teams (also known as squads or guilds) to users, encouraging them to join teams they are interested in and cooperate with teammates. Online shopping platforms recommend products to users, enabling them to quickly find the items they need. Users' interests may change over time. For team recommendations in virtual games, when a user is leveling up their account, they are interested in teams with higher-level teammates; when a user wants to compete for the best team member title, they are interested in teams with lower-level teammates. Similarly, for product recommendations on online shopping platforms, users may be interested in home furnishings at one time and food products at another. Therefore, how to conduct efficient and effective product recommendations is a pressing issue that needs to be addressed.
[0034] For the reasons mentioned above, in order to dynamically and efficiently recommend objects over time, the first embodiment of this application provides an object recommendation method. This method is applicable to object recommendation in the various scenarios mentioned above. The method is applied to electronic devices, which may be desktop computers, laptops, mobile phones, tablets, servers, etc., or other electronic devices capable of storing and running programs for object recommendation methods. This embodiment of the application does not specifically limit the application to these devices.
[0035] like Figure 1 As shown, the object recommendation method provided in this application includes the following steps 101 to 105.
[0036] Step 101: In response to the instruction to determine whether the target object is qualified for recommendation for the target user, obtain the identification information of the target object.
[0037] In specific embodiments, the objects in object recommendations may include, but are not limited to, at least one of the following: virtual elements in virtual games, products on online shopping platforms, audio, and video. The objects involved in this application can be any objects that can be recommended to users, and this application does not specifically limit them.
[0038] Virtual elements in virtual games may include, but are not limited to, at least one of the following: virtual items, virtual equipment, virtual skins, teams, and rooms. Online shopping platforms may be e-commerce platforms or third-party delivery platforms, and the goods sold on these platforms may include, but are not limited to, at least one of the following: household goods, food goods, and medicines.
[0039] Virtual games are software application products that run on terminal devices. Terminal devices can be any of the following: desktop computers, laptops, mobile phones, tablets, or smartwatches. Game software application products include, but are not limited to, any of the following: third-person shooter game applications, single-player game applications, and multiplayer online battle arena (MOBA) games. The types of games mentioned above can include, but are not limited to, at least one of the following: two-dimensional (2D) game applications, three-dimensional (3D) game applications, virtual reality (VR) game applications, augmented reality (AR) game applications, and mixed reality (MR) game applications. The above is merely an example, and this embodiment does not impose any limitations on it.
[0040] It should be noted that, in order to provide a detailed description of the object recommendation method provided in this application, this embodiment uses the application of the object recommendation method in a virtual game as an example for illustration, specifically recommending teams for users in a virtual game, and is not intended to limit this application.
[0041] In virtual games, target users can operate virtual characters within a virtual game scene using their terminal devices. These activities include, but are not limited to, adjusting body posture, crawling, walking, running, jumping, driving, picking up items, shooting, attacking, and throwing at least one of these. Virtual characters refer to characters that do not exist in reality; they can be fictional characters from creative works such as TV series, movies, comics, and games. Virtual characters can include, but are not limited to, virtual figures and virtual animals.
[0042] In practical applications, this step can specifically respond to a team recommendation command triggered in the virtual game, and select a target team from the teams already established in the virtual game for the target user. The team recommendation command can be automatically triggered when the target user enters the virtual game, or it can be triggered by the target user clicking the corresponding control in the virtual game interface.
[0043] Virtual games can have multiple teams, each containing at least one user. Users may have specific intentions when choosing a team, typically selecting one that matches their own characteristics in certain aspects. In practice, users can choose a team based on at least one of the following team attributes: the region of the team members, the level of the team members, the role type of the team members, and the active time periods of the team members in the virtual game. For example, user A might prefer to join a team where members' levels are the same as their own or the level difference is no more than a preset level difference. Because users have certain preferences when choosing teams, at least some users in a team may have similarities in terms of region, level, role type, and active time periods.
[0044] Therefore, when recommending teams, user information of the target user can be obtained with their authorization, including but not limited to region, level, role type, and active time period. This user information is then matched with teams created in the virtual game, and teams with a match score higher than a preset match score are selected as recommended teams to the target user. Correspondingly, the matching can be based on at least one of the following: region, level, role type, and active time period.
[0045] Once the target object is identified, an instruction can be triggered to determine whether the target object is eligible for recommendation by the target user. In practice, the target object may or may not be eligible for recommendation. An object ineligible for recommendation can be one that was recommended to the user within a specific timeframe, including at least one of the following: an object recommended to the user but not accepted by the user, or an object recommended to the user but accepted by the user. If a user does not accept an object after it has been recommended, it means that the user is not interested in that object. If a user accepts an object after it has been recommended, then recommending that object to the same user again is meaningless. For example, if a team was recommended to a user just an hour ago, then that team is ineligible for recommendation. Understandably, users have a lower acceptance rate when recommending ineligible objects.
[0046] The target object's identification information in this step can be understood as its unique identifier within the application. In the context of the application, this identification information can be understood as the target team's unique identifier (UID) in the virtual game. Each time a team is created in the virtual game, it is assigned a unique UID. This UID can be a string of characters or a vector. There is a one-to-one correspondence between teams and unique identifiers; based on the unique identifier, a unique team can be identified in the virtual game.
[0047] In this step, the identification information of the target object can also be the digest information extracted from the unique identity information (UID) corresponding to the target object. The digest information can be extracted from the unique identity information (UID) using a hash function. A hash function is a computer program used in function operations to transform input data of arbitrary length into output data of fixed length; this output is the "hash value." The hash algorithm's conversion of input data of arbitrary length into output data of fixed length is a compression mapping, meaning the space of hash values is usually much smaller than the space of the input data. This application does not specifically limit the identification information of the target object.
[0048] It should be noted that when the identification information of a target object is a digest extracted from the unique identifier (UID) corresponding to that target object, the digest extracted from different identification information may be the same, which may lead to misjudgment during subsequent data queries. To reduce the misjudgment rate, the data length of the digest information can be appropriately increased to reduce the collision rate between digests corresponding to different representation information. In this application, the data length of the target object's identification information is described as 8 bits.
[0049] Understandably, the target user in this step can be one user or multiple users, and the target object determined for a target user can be one object or multiple objects; this application does not limit this.
[0050] This technology allows for the determination of whether a target user is eligible for recommendation after receiving an instruction to do so. By obtaining the target user's identification information, it provides a basis for subsequent steps to query whether the target user is eligible for recommendation.
[0051] Step 102: Determine the first storage location in the preset data structure filter based on the identification information of the target object.
[0052] The data structure filter includes multiple storage locations, which are used to store the identification information of the first object recommended to the target user and the deactivation time information for re-recommending the first object.
[0053] In virtual games, a data structure filter can be preset for one user, multiple users, or all users in the virtual game. Correspondingly, the storage location in this step is used to store the identification information of the first object recommended to the target user; that is, the storage location is used to store the identification information of at least the first object recommended to the target user.
[0054] The data structure filter in this step can be a cuckoo filter or a filter with the same function as a cuckoo filter. A cuckoo filter is a data structure used to quickly retrieve whether an element is in a set. It has low space consumption and good query performance, and can delete stored data. To better understand the technical solution provided in this application, a cuckoo filter is used as the data structure filter in this embodiment. In this application, the cuckoo filter stores the identification information of objects. When the cuckoo filter stores the identification information of an object, it means that the object has been recommended to the target user.
[0055] The following is an introduction to the Cuckoo filter:
[0056] The cuckoo filter consists of several buckets, each with several storage locations. Each storage location can store one element. Since elements occupy a large amount of storage space, to reduce storage pressure, the cuckoo filter typically stores the element's fingerprint. The fingerprint is an n-bit hash generated from the element, and its length is less than the element's bit length. The number of buckets, the number of storage locations in each bucket, and the fingerprint's data length are determined based on specific circumstances, and this application does not impose specific limitations on them.
[0057] The following is the process of adding elements to the Cuckoo filter:
[0058] When an element is added to the Cuckoo Filter in the initial state, the fingerprint fingerprint(x) of the element is first extracted using the hash function fingerprint. Then, multiple function values of the added element are calculated using multiple hash functions. The obtained function values correspond to multiple bucket indices in the Cuckoo Filter. Based on the obtained bucket indices, the corresponding multiple buckets are determined. The n storage locations in the determined multiple buckets are the n candidate storage locations of the fingerprint fingerprint(x). One of the candidate storage locations is randomly selected to store the fingerprint fingerprint(x).
[0059] For ease of understanding, this application uses an example where two hash functions yield two bucket indices, and each bucket corresponds to four storage locations. Thus, each fingerprint has eight candidate storage locations, and when storing a fingerprint, one of these eight candidate locations is selected. It should be noted that, typically, the two bucket indices calculated for different elements are not the same. For example, element A corresponds to bucket indices 1 and 2, while element B corresponds to bucket indices 1 and 3.
[0060] Specifically, this step involves performing a hash operation on the identifier information of the target object to obtain the corresponding indexes of the two candidate buckets in the Cuckoo Filter. The eight storage locations corresponding to the two candidate bucket indices can be understood as the first storage location in the Cuckoo Filter where the identifier information of the target object can be stored.
[0061] The first storage location may not store the target object's identification information, or it may have already stored the target object's identification information. If the first storage location does not store the target object's identification information, when storing the target object's identification information in the Cuckoo Filter, the target object's identification information will be stored in the first storage location.
[0062] Since the Cuckoo Filter has the feature of deleting stored fingerprints, in this embodiment of the application, when storing the identification information of the first object that has been recommended to the target user, the Cuckoo Filter can store the corresponding deactivation time information for re-recommending the first object. In this way, the deactivation time information is used to determine whether the first object can be recommended to the user again.
[0063] The deactivation time information can be the deactivation time used to re-recommend the first object. The stored data format can be: a specific year, month, day, hour, minute, and second, or the total number of seconds from Greenwich Mean Time (GMT) 00:00:00 on January 1, 1970, to the present. For example, in a virtual game, if a team recommended within the past 7 days is not repeatedly recommended to a user, and team 1 recommends a team to a user at 10:00:00 on February 10, 2023, it can be determined that team 1 will not recommend a team to that user again before 10:00:00 on February 17, 2023. Therefore, the deactivation time information for team 1 can be 10:00:00 on February 17, 2023, or it can be 1676599200 seconds (decimal), which, converted to binary, is: 01100011111011101101111110100000. Thus, based on the release time indicated in the release time information, team 1 can resume recommending to users at 10:00:00 on February 17, 2023. This application does not specifically limit the form of the release time.
[0064] Step 103: Read data from the first storage location.
[0065] Understandably, the first storage location may or may not contain data. Furthermore, the bucket indices in the cuckoo filter determined by different object identifiers may overlap; therefore, the first storage location may contain object data for other objects. For example: Based on identifier 1 of team 1, the bucket indices are calculated as bucket 1 and bucket 2. Identifier 1 and the corresponding release time information are stored in the storage location corresponding to bucket 1. Based on identifier 2 of team 2, the bucket indices are calculated as bucket 1 and bucket 3. When reading data from bucket 1 and bucket 3, the storage location corresponding to bucket 1 contains team 1's identifier 1 and the corresponding release time information.
[0066] Since the target object's identification information is stored in the Cuckoo Filter, the storage location of the target object's identification information is the first storage location. Therefore, in this step, data can be read from the first storage location to determine whether the target object's identification information is stored in the Cuckoo Filter. In subsequent steps, the results of the data reading in this step will be used to determine whether the target object is qualified to be recommended to the target user.
[0067] Step 104: If, when data is read from the first storage location, the read data includes the identification information of the target object, and the first release time indicated by the release time information in the read data is less than or equal to the current time, then it is determined that the target object is qualified to be recommended to the target user, and the target object is recommended to the target user.
[0068] When data is read from the first storage location, the data stored in the first storage location includes the object's identification information and the corresponding release time information. Since the first storage location may store identification information for other objects, or it may store the target object's identification information, it's possible to first determine the object to which the identification information stored in the first storage location belongs. If the first storage location stores the target object's identification information, it's necessary to determine whether the current time has reached the release time recommended by the target object for re-recommendation. Alternatively, when data is read from the first storage location, it's possible to first determine whether the current time has reached the release time indicated by the release time information stored in the first storage location. If the release time has been reached, it's possible to determine whether the identification information corresponding to that release time belongs to the target object. It's understandable that, at the current time, reaching the release time includes both a release time that is the same as the current time and a release time that is before the current time.
[0069] It should be noted that the two judgment conditions in this step do not have an execution order. Either judgment condition can be executed first, and the other judgment condition can be executed only if either judgment condition is satisfied. Judgment condition 1: If the read data includes the identification information of the target object; Judgment condition 2: If the first release time indicated by the release time information in the read data is less than or equal to the current time. If both judgment conditions are satisfied simultaneously, it is determined that the target object is qualified to be recommended to the target user, and the target object is recommended to the target user.
[0070] Since the first storage location can be calculated based on the target object's identification information or on the identification information of other objects, the data stored in the first storage location may include the target object's identification information and release time information, or it may include the identification information and release time information of other objects. Therefore, when data is read from the first storage location, the read data may include the target object's identification information and release time information, or it may include the identification information and release time information of other objects, but not the target object's identification information and release time information.
[0071] If the data read includes the target object's identification information, and the first release time indicated by the release time information in the read data is less than or equal to the current time, it means that the target object is eligible to be recommended again at the current time. For example, if the current time is 10:00:00 on February 10, 2023, and the first release time for team 1 is 8:00:00 on February 10, 2023, it means that team 1 can be recommended to users again at the current time.
[0072] When a target object is qualified to be recommended to a target user, it can be recommended to the target user, so that the target user can choose objects of interest based on the recommended target objects.
[0073] Understandably, when multiple eligible target objects are identified for a single target user, all of these target objects can be recommended to that user, allowing the user to choose from them. Alternatively, with the user's authorization, a target object with a high degree of matching with the user's information can be selected from among the multiple target objects for recommendation. This application does not specifically limit this approach.
[0074] The object recommendation method provided in this application, in response to an instruction to determine whether a target object is qualified for recommendation to a target user, obtains the identification information of the target object; determines a first storage location in a preset data structure filter based on the identification information of the target object, wherein the data structure filter includes multiple storage locations, the storage locations being used to store the identification information of a first object previously recommended to the target user and deactivation time information for re-recommending the first object; reads data from the first storage location; if, when data is read from the first storage location, the read data includes the identification information of the target object, and the first deactivation time indicated by the deactivation time information in the read data is less than or equal to the current time, then it is determined that the target object is qualified for recommendation to the target user, and the target object is recommended to the target user.
[0075] Since the preset data structure filter stores the identification information and corresponding release time information of the first recommended object, if the target object's identification information is stored in the Cuckoo Filter, its storage location is the first storage location determined in the data structure filter based on the target object's identification information. Thus, when the first storage location stores the target object's identification information, and the first release time indicated by the corresponding release time information is less than or equal to the current time, it means that the target object has reached the set release time for re-recommendation at the current time, and therefore the target object is eligible for re-recommendation. It is evident that the object recommendation method provided in this application can dynamically and efficiently recommend objects over time, thereby increasing user acceptance of the recommended objects and improving the user experience.
[0076] In a specific implementation, the identification information of the target object may not be stored in the cuckoo filter. Therefore, the object recommendation method provided in this application may also include the following steps 201-202:
[0077] Step 201: If no data is read from the first storage location, or if data is read from the first storage location but the read data does not include the identification information of the target object, determine that the target object is qualified to be recommended to the target user, and recommend the target object to the target user.
[0078] Step 202: Store the identification information of the target object in the first storage location, and store the first release time information of the target object.
[0079] Understandably, when no data is read from the first storage location, meaning no information is stored there, the Cuckoo Filter naturally does not store the target object's identifier information. Therefore, it can be concluded that the target object has not been recommended to the target user, suggesting that the target object might be of interest to the target user. Consequently, the filter determines that the target object is eligible for recommendation to the target user and recommends it to them.
[0080] When data is read from the first storage location, it is necessary to determine whether the first storage location stores the target object's identification information. If the first storage location does not store the target object's identification information, it can be determined that the target object's identification information is not stored in the Cuckoo Filter. In this case, the target object has not been recommended to the target user, therefore, it is determined that the target object is eligible for recommendation to the target user, and the target object is recommended to the target user.
[0081] Since the Cuckoo Filter stores the identification information of objects recommended to the target user, even if the Cuckoo Filter does not store the identification information of the target object, when recommending a target object to the target user, the target object's identification information can be stored in the first storage location of the Cuckoo Filter. When storing the target object's identification information, the release time information, which indicates whether the target object can be re-recommended to the target user, can also be stored in the first storage location of the Cuckoo Filter. In this way, when recommending objects to the target user in the game, if the candidate object list contains the target object, the target object and its corresponding release time information can be retrieved from the Cuckoo Filter, and the decision on whether to recommend it to the target user can be made based on the query results.
[0082] The following combination Figure 2 The data stored in the data structure filter provided in the embodiments of this application will be described.
[0083] like Figure 2 The diagram shown is a schematic of the data stored in the data structure filter provided in the embodiment of this application. Figure 2The image shows eight buckets in the Cuckoo Filter, with bucket indices from 0 to 7. Each bucket has four storage locations. The identifier for object B is fingerB. The bucket indices obtained through hash1 and hash2 are 1 and 5, respectively. Therefore, fingerB can be stored in either bucket 1 or bucket 5. As shown in interface 2-a, when adding fingerB, if all storage locations in bucket 1 are already filled with data, any free storage location in bucket 5 is selected to store fingerB. As shown in interface 2-b, if all storage locations in buckets 1 and 5 are full of fingerprints, data f3 stored in either bucket 1 or bucket 5 is randomly selected. The bucket indices of f3 are calculated to be 1 and 3. f3 is then moved from its original storage location in bucket 1 to the free storage location corresponding to bucket 3, and fingerB is stored in the original storage location of f3 in bucket 1. When there is no free space in bucket 3, any storage location can be randomly selected from bucket 1 and bucket 3 to store data f3. The data in the selected storage location is transferred in the same way as data f3 until a free space is found. Then, fingerB is stored in the original storage location of f3 in bucket 1.
[0084] In practical applications, there may be multiple first storage locations. This application uses an example of eight first storage locations for illustration. When data is read from the first storage location, and the read data does not include the identification information of the target object, the first storage location stores the identification information of other objects. The eight first storage locations may or may not include any free locations. Therefore, step 202, "storing the identification information of the target object in the first storage location and storing the first release time information of the target object," can be achieved through steps 208 to 210.
[0085] Step 208: If each of the first storage locations includes a free location, store the identification information and release time information of the target object in the free location of each of the first storage locations.
[0086] Step 209: If no free space is included in each of the first storage locations, select a target first storage location from each of the first storage locations, and check whether there is a free space in the data structure filter;
[0087] Step 210: If there is an empty space in the data structure filter, the identification information and release time information of the second object stored in the first target storage location are transferred, and the identification information and release time information of the target object are stored in the first target storage location.
[0088] When there are free locations among multiple first storage locations, the identification information and release time information of the target object can be stored in any free location among the first storage locations.
[0089] If no free location exists among the multiple first storage locations, one of the multiple first storage locations can be selected as the target first storage location, and the cuckoo filter will be checked to see if a free location exists. If a free location exists in the cuckoo filter, the data stored in the target first storage location will be transferred, and the target object's identification information and release time information will be stored in the first storage location.
[0090] It should be noted that transferring data stored in the target first storage location involves calculating the corresponding storage location based on the object's identification information. The data is then transferred from the target first storage location to a storage location not belonging to the same bucket as the target first storage location. If there are no free spaces in the storage locations not belonging to the target first storage location, data stored in any of these locations is transferred. If free spaces exist in the Cuckoo Filter, at least one transfer will ensure the data of the transferred object is moved to the corresponding storage location. This "frees up" the target first storage location, making it suitable for storing the target object's identification information and release time information.
[0091] Specifically, step 209, "checking whether there is a free space in the data structure filter," can be achieved through the following step 211: Using the second object as the initial object to be transferred, the following first step is executed repeatedly within a preset number of iterations to check whether there is a free space in the data structure filter. The first step includes: determining a third storage location in the data structure filter based on the identification information of the object to be transferred; searching for a free space in each of the third storage locations; and ending the loop if a free space is found in each of the third storage locations.
[0092] Accordingly, step 210, "transferring the identification information and release time information of the second object stored in the first target storage location", can be achieved through the following steps: transferring the identification information and release time information of the second object to an empty location in each of the third storage locations determined based on the identification information of the second object.
[0093] It should be noted that the phrase "if a free location is found in each of the third storage locations, then the loop ends" in step 211 above refers to the situation where a free location is found in the cuckoo filter when the first step executes one loop. In practical applications, a free location may not be found in the cuckoo filter when the first step executes one loop. In this case, the data stored in the cuckoo filter can be transferred multiple times sequentially.
[0094] Therefore, the "first step" in step 211 may also include the following steps:
[0095] If no free location is found in any of the third storage locations, the object stored in the target third storage location is identified as the object to be transferred, and the first step is returned to be executed until a free location is found in the data structure filter, at which point the loop ends.
[0096] Accordingly, step 210, "transferring the identification information and release time information of the second object stored in the first target storage location", can be achieved through the following steps: for each object to be transferred in the loop process of the first step, the identification information and release time information of the object to be transferred are transferred to the free position in each of the third storage locations determined based on the identification information of the object to be transferred.
[0097] Specifically, when storing data A of the target object, we can find other free locations without stored data from the 8 first storage locations to store data A; when there are no free locations, we can randomly select location 1 from the 8 first storage locations. Location 1 is located in bucket a, and the data B stored in location 1 is transferred, and data A is stored in location 1.
[0098] In this embodiment, data B can be transferred as follows: Based on the identification information in data B, the corresponding bucket indices a and b are determined. Data B is then transferred from position 1 in the current bucket a to any free position in bucket b, i.e., data B is transferred from its current storage location to a storage location that does not belong to the same bucket as the current storage location. If there is no free position in bucket b, the above method can be continued to transfer data stored in any storage location in bucket b until data is successfully transferred. Then, data A can be stored in position 1 of bucket a.
[0099] If, after multiple attempts, no free space can be found, the cuckoo filter is considered full. In this case, even with countless attempts to move data between storage locations, no free space can be found in the cuckoo filter. Therefore, to prevent unlimited data transfer within the cuckoo filter, a preset number of moves can be set. If the preset number of data moves between storage locations is reached and no free space is found, the cuckoo filter is considered full.
[0100] Therefore, the maximum number of iterations in the first step is a preset number. In practical applications, if no free space is found in the cuckoo filter after the preset number of iterations in the first step, the first step will not be executed again. Therefore, the first step also includes: if no free space is found after the preset number of iterations in the first step, it is determined that there is no free space in the data structure filter, and the loop ends.
[0101] In this application, when transferring data stored in the cuckoo filter, the loop ends in one of the following three cases:
[0102] Scenario 1: Transfer the data stored in the cuckoo filter once to find an empty position, and the loop ends;
[0103] Scenario 2: Within a preset number of iterations, the data stored in the cuckoo filter is transferred multiple times to find an empty position, and the loop ends.
[0104] Scenario 3: When the number of times the data stored in the Cuckoo Filter is transferred reaches the preset number, and no free space is found in the Cuckoo Filter, the loop ends.
[0105] Furthermore, if no free space is found in the cuckoo filter when the first step reaches a preset number of iterations, data will be unable to be added to the cuckoo filter. Therefore, it is necessary to delete data from one or more storage locations from the cuckoo filter to free up storage space. Regarding which storage locations to delete when the cuckoo filter is full, this application embodiment provides the following optional deletion strategy:
[0106] If there is no free space in the data structure filter, then delete the object data whose expiration time is close to the current time to create a free space in the data structure filter; transfer the identification information and release time information of the second object stored in the target first storage location, and store the identification information and release time information of the target object in the target first storage location.
[0107] In this deletion strategy, considering that objects whose expiration time is closer to the current time have not been recommended to users for a long time, the closer the expiration time of an object in the Cuckoo Filter is to the current time, the earlier the object was last recommended to the user. Therefore, when recommending objects whose last recommendation time was earlier, users are more likely to accept them. Thus, when the Cuckoo Filter is full (i.e., the number of loops in the first step of this application reaches the preset number), data in one or more storage locations corresponding to expiration times close to the current time can be deleted to free up one or more storage locations.
[0108] For example: When storing data A on February 10, 2023, the Cuckoo Filter is full. The release time for data B stored in storage location 1 is February 14, 2023, the release time for data C stored in storage location 2 is February 16, 2023, and the release time for data D stored in storage location 2 is February 11, 2023. This means that data D is about to reach its release time. Therefore, data D stored in storage location 2 can be deleted to release storage location 2.
[0109] By employing the aforementioned technical means, when the Cuckoo Filter is full, deleting object data whose release time is close to the current time can create free space in the Cuckoo Filter, thereby enabling data storage in the Cuckoo Filter to be completed through a certain number of attempts and transfers. On the other hand, deleting objects whose release time is close to the current time from the Cuckoo Filter allows the object recommendation method provided in this application to prioritize recommending objects whose release time is close to the current time when recommending objects.
[0110] In a specific implementation, since the amount of data stored in the cuckoo filter is enormous, traversing each storage location to find data whose expiration time is close to the current time would obviously waste a lot of time and increase data processing costs. Therefore, this application provides the following steps to more efficiently implement the "delete object data whose expiration time is close to the current time" in the "deletion strategy":
[0111] The first step is executed repeatedly within the first number of transfers. If there are no free positions in the data structure filter, for each object to be transferred in the loop process of the first step within the first number of transfers, the release time information corresponding to each object to be transferred is obtained.
[0112] If the release time indicated by the release time information corresponding to each of the objects to be transferred is greater than the current time, then the minimum release time is determined from the release times indicated by the release time information corresponding to each of the objects to be transferred.
[0113] The first step is executed repeatedly within the second number of transfers. The release time information of the object to be transferred is obtained for each transfer. If the release time indicated by the release time information of the object to be transferred at the i-th transfer is less than the minimum release time, the object identifier and release time information of the object to be transferred at the i-th transfer are deleted.
[0114] If the release time indicated by the release time information of each object to be transferred in the first step of the second transfer count is greater than or equal to the minimum release time, then the object identifier and release time information of the object to be transferred corresponding to the minimum release time are deleted. When the number of cycles in the first step reaches the second transfer count, the cycle stops.
[0115] Wherein, the sum of the first number of transfers and the second number of transfers is not greater than the preset number.
[0116] The above method is a strategy based on the problem of stopping. The data transfer within the first number of transfers can be regarded as an evaluation of all the data stored in the cuckoo filter, and the data transfer within the second number of transfers can be regarded as the elimination of the data stored in the cuckoo filter based on the evaluation results within the first number of transfers.
[0117] The concept of pausing can be understood through the following example: When conducting an interview, if there are a large number of candidates, you can first select candidates from the interviewees and interview them n times to understand their approximate level. Then, in the m interviews, if you find a candidate who is more in line with your expectations than the candidates in the n interviews, you can hire them directly.
[0118] In the above steps, the first step, executed repeatedly within the first transfer iteration, can be understood as the sampling phase, and the first step, executed repeatedly within the second transfer iteration, can be understood as the elimination phase. During the sampling phase, the release time information corresponding to each object to be transferred during the first step's loop is obtained, and the minimum release time is determined from this information. If no free position is found in the Cuckoo Filter during the sampling phase, the elimination phase begins. Once it is found that the release time corresponding to a certain transfer data is less than the minimum release time, the data stored at the storage location corresponding to that release time is deleted, thus removing data with release times close to the current time and creating a free position in the Cuckoo Filter.
[0119] If no data with a release time less than the minimum release time is found during the entire elimination phase, the data stored in the storage location corresponding to the minimum release time is deleted, thereby deleting data with a release time close to the current time and creating a free space in the Cuckoo Filter.
[0120] Specifically as follows:
[0121] Sampling Phase: When storing data, attempt to transfer the stored data n times. During each of the n transfers, obtain the release time indicated by the release time information of each data to be transferred, and record the minimum release time t_ during the n transfers. 最小解除 .
[0122] Elimination Phase: Within m iterations, attempt to cyclically transfer the stored data, and compare the release time of each piece of data to be transferred in each iteration with the minimum release time t_ recorded in the sampling phase. 最小解除 If the release time of data 1 in a certain transfer is less than t_ 最小解除 If data 1 is deleted and its corresponding storage location is freed up, the cyclic transfer of the elimination phase ends; if the cyclic transfer count of the elimination phase reaches m times and no release time less than t_ is found, then... 最小解除 The data will then be t_ 最小解除 The corresponding fingerprint is deleted.
[0123] Understandably, if during the first step of the sampling phase, if the release time of a certain piece of data to be transferred is detected to be less than or equal to the current time, it means that the object corresponding to the data has the qualification to be recommended again. In this case, the data will be deleted from the storage location corresponding to the Cuckoo Filter, and the loop will end. The first step will not be executed in subsequent loops of the sampling phase, nor will the first step be executed in the elimination phase.
[0124] Typically, hash1 and hash2 are two different hash values determined based on the unique identifier (UID) of the stored object. During data transfer, the bucket index corresponding to the data needs to be determined based on the hash function. In practical applications, in order to reduce the storage space occupied by the data in the Cuckoo Filter, the Cuckoo Filter stores the digest information extracted from the unique identifier (UID) of the object (hereinafter referred to as the object fingerprint). Therefore, in order to quickly determine the other bucket index corresponding to the object fingerprint based on the stored object fingerprint and the bucket index corresponding to the current storage location of the object fingerprint, hash1 and hash2 can be calculated using the following formulas (1) and (2):
[0125] hash1=hash(x) formula (1)
[0126]
[0127] Where x is the object's unique identifier (UID), f(x) is the object's fingerprint, g(f(x)) is the hash value of the object's fingerprint, and hash1 and hash2 are the two bucket indices corresponding to the object's fingerprint f(x). Hash(x) and g(x) can be the same hash function or different hash functions, which is not specifically limited here.
[0128] In this way, a bucket index can be obtained by XORing another bucket index with the hash value of the object's fingerprint, without needing to obtain the object's unique identifier (UID). This makes data transfer in the Cuckoo Filter more efficient.
[0129] It should be noted that the fingerprint f(x) is calculated from element x using a hash function, and hash1 is also calculated from element x using a hash function. However, the fingerprint f(x) is used to confirm which element was added, while hash1 is used to indicate which bucket the storage location of the fingerprint f(x) belongs to. The number of bits corresponding to the fingerprint f(x) and hash1 are not the same.
[0130] This technology allows for the storage of target object identification information and deactivation time information in the first storage location of the Cuckoo Filter, even when the target object's identification information is not stored in the filter itself. This prevents the target object from being recommended to the user again within a specific time period, enabling dynamic object recommendations that better meet the user's expectations.
[0131] Furthermore, if the target object's identification information is stored in the Cuckoo Filter, the current time may not yet have reached the target object's deactivation time. Therefore, the object recommendation method provided in this application may further include the following steps: when reading data from the first storage location, if the read data includes the target object's identification information, and the deactivation time information in the read data indicates a deactivation time greater than the current time, then it is determined that the target object is not eligible for recommendation to the target user.
[0132] The following example illustrates the application scenario where the delisting time is greater than the current time: The delisting time for the target team is February 17, 2023, and the current time is February 10, 2023. In this case, the target team has not yet changed to a team that has restarted recommending to the target user. The target team has just recommended to the target user within a specific time period, and the target user may not be interested in recommending to the target user again, resulting in a low acceptance rate. Therefore, it can be determined that the target team is not qualified to recommend to the target user, and thus the target team will not be recommended to the target user.
[0133] Optionally, in step 104, when the first storage location stores the identification information of the target object, and the first release time indicated by the release time information of the target object is less than or equal to the current time, the time used to re-recommend the target object to the target user will be updated when recommending the target object to the target user. Therefore, the release time information of the target object can also be updated. Thus, the object recommendation method provided in this application may further include the following steps:
[0134] Based on the current time and the preset blocking period, update the release time information corresponding to the target object stored in the first storage location.
[0135] Understandably, after the target object is re-recommended to the target user, the first deactivation time of the target object will change, and correspondingly, the deactivation time information used to indicate the first deactivation time will also change.
[0136] Therefore, when the identification information and release time information of the target object are stored in the first storage location, if it is detected that the first release time indicated by the release time information is less than or equal to the current time, and the target object is recommended to the target user, the latest release time information of the target object can be recalculated according to the current time and the preset blocking period, and the latest release time information is stored as the release time information of the target object in the first storage location of the Cuckoo Filter.
[0137] Specifically, the latest unblocking time information is the sum of the current time and the preset blocking period. The preset blocking period is used to indicate the duration for which an object no longer has the qualification to be recommended after being recommended to a user. The preset blocking period can be set for one user or for multiple users. This application does not specifically limit this.
[0138] For example, if the first removal time information stored in the Cuckoo Filter indicates that the target object's removal time is February 10, 2023, then the target object can be recommended to the target user on February 11, 2023, with a set blocking period of 7 days. At this time, the first removal time of the target object is changed to February 18, 2023. In this way, the removal time information stored in the Cuckoo Filter can be changed to the latest removal time information indicating that the first removal time is February 18, 2023.
[0139] In this way, when an object corresponding to the identification information stored in the Cuckoo Filter is recommended to a user, the release time information of that object stored in the Cuckoo Filter is updated with the latest time of the recommendation. This allows the filter to determine whether the target object can be recommended to the target user again when recommending the target object again, based on the latest release time information, thus making object recommendations to users accurate and efficient.
[0140] Since the object identification information stored in the Cuckoo Filter corresponds to a release time information, and the computer usually stores time information in the form of binary timestamp data, the release time information has a data length of 32 bits. Compared with the object identification information with a data length of 8 bits, the space occupied by the release time information is too large, which increases the data storage pressure of the Cuckoo Filter and thus reduces the efficiency of data storage, data query and data deletion from the Cuckoo Filter.
[0141] Therefore, in order to reduce space usage, the "storing the first release time information of the target object" in step 202 can be achieved through steps 203 to 205.
[0142] Step 203: Determine the sum of the current time and the preset shielding period as the first release time of the target object.
[0143] Step 204: Obtain the first reference time corresponding to the first storage location.
[0144] Step 205: If the data length of the first difference between the first release time and the first reference time is less than or equal to a preset length, the first difference is determined as the first release time information of the target object, and the first release time information is stored.
[0145] The storage locations in the data structure filters are associated with a reference time, and the same reference time corresponds to at least two storage locations.
[0146] In this application, the same reference time is shared by at least two storage locations. The storage location stores the difference between the release time and the corresponding reference time. Since the data length of the time difference is much smaller than the data length of the time, the storage space occupied by the difference is also much smaller than the storage space occupied by the release time.
[0147] Understandably, in order to limit the upper limit of the space occupied by the difference stored in the storage location of the cuckoo filter, so that the difference does not take up too much space, a preset length can be set. When the difference is within the preset length, the difference can be stored normally in the storage location of the cuckoo filter.
[0148] First, determine the first release time of the target object, which is the sum of the current time and the preset shielding period. Then, obtain the first reference time corresponding to the first storage location. Since at least two storage locations correspond to the same reference time, the storage location corresponding to the first reference time includes other storage locations in addition to the first storage location. After that, if the first difference between the first release time and the first reference time does not exceed the preset length and can be stored normally in the Cuckoo Filter, determine the first difference as the first release time information of the target object and store the first release time information in the first storage location.
[0149] The following is passed Figure 3 The release time information stored in the storage location of the data structure filter in the embodiments of this application will be described in detail.
[0150] As shown in interface 3-a, this is a schematic diagram of storing the release time at the storage location of the data structure filter provided in this application embodiment. When storing fingerprints f1 to f8 in buckets 1 and 5, the corresponding release time t1 is... 解除 ~t8_ 解除 Store it in the corresponding storage location. Since each release time occupies 32 bits of storage space, we know that t1_ 解除 ~t8_ 解除 It occupies a total of 256 bits of storage space.
[0151] As shown in Interface 3-b, this is an example diagram of storing differences in the storage locations of the data structure filter provided in this embodiment of the application, where a base time t is set for the 32 storage locations. 基准 The difference time corresponding to each fingerprint at each storage location is calculated based on the defiltering time corresponding to the fingerprint at each storage location. When storing fingerprints f1 to f8 in buckets 1 and 5, the corresponding difference time t1 is set. 差值 ~t8_ 差值 Store it in the corresponding storage location. Since each difference occupies 18 bits of storage space, we know that t1_ 差值 ~t8_ 差值 It occupies a total of 144 bits of storage space. Because t_ 基准 It occupies 32 bits of storage space, so t1_ 差值 ~t8_ 差值 and t_ 基准 It occupies a total of 176 bits of storage space, which is much smaller than t1_ in interface 3-a. 解除 ~t8_ 解除 Storage space occupied. In interface 3-b, every 8 buckets correspond to a base time. In specific implementations, multiple storage locations corresponding to the same base time can be storage locations within the same bucket or storage locations in different buckets. This application does not specifically limit this.
[0152] By using this technique, when storing the identification information of stored objects, storing the time difference with a shorter data length instead of the time with a longer data length, the release time information stored in the Cuckoo Filter occupies less storage space, allowing the Cuckoo Filter to respond to data requests in a timely manner, thereby improving the efficiency of data storage, querying, and deletion from the Cuckoo Filter.
[0153] In practical applications, since the stored difference is determined by the release time and the base time, and the release time is determined based on the current time in step 203 and the preset masking period, the current time in step 203 is the time when the target object's identification information is added to the Cuckoo filter. Therefore, to ensure that the data length of the difference does not exceed the preset length, the corresponding base time and the current time also have a certain relationship. The following example will explain the relationship between the base time and the current time in detail.
[0154] The preset length can be determined based on the data length of the preset shielding period. The preset length can be the preset shielding period, 2*preset shielding period, 3*preset shielding period, etc.
[0155] When the preset length is the preset shielding period, if the difference can be stored normally, then t 差值 <= w, because t 差值 =t 解除 -t 基准 Therefore, t 解除 -t 基准 <= w, because t 解除 =t 当前 +w, therefore, t 当前 +wt 基准 <= w, thus obtaining t 基准 >=t 当前 Among them, t 差值 The difference stored at the storage location of the cuckoo filter, w is the preset shielding period, and t is the value stored at the storage location. 解除 t is the release time of the object to which the identification information stored at the storage location belongs. 基准 t represents the base time corresponding to the storage location. 当前 This is the current time.
[0156] When the preset length is 2 * preset shielding period, if the difference can be stored normally, then t 差值 <= 2*w, thus obtaining t 基准 >=t 当前 -w.
[0157] When the preset length is 3 * preset shielding period, if the difference can be stored normally, then t 差值 <= 3*w, thus obtaining t 基准 >=t当前 -2*w.
[0158] Table 1 shows the relationship between the reference time and the current time under different preset lengths provided in the embodiments of this application.
[0159] Table 1.
[0160] Preset range Relationship between reference time and current time w <![CDATA[t 基准 >=t 当前 ]]> 2*w <![CDATA[t 基准 >=t 当前 -w]]> 3*w <![CDATA[t 基准 >=t 当前 -2*w]]>
[0161] Understandably, when the object identification information is stored in the Cuckoo Filter at a certain moment, if the calculated difference exceeds the preset length, it is considered that the space occupied by the difference will be too large. Therefore, it is necessary to adjust the base time set at the corresponding storage location so that the space occupied by the difference calculated based on the adjusted base time can be kept within the preset length.
[0162] Therefore, the object recommendation method provided in this application may also include steps 206 to 207.
[0163] Step 206: If the data length of the first difference between the first release time and the first reference time is greater than the preset length, update the first reference time so that the updated first reference time is not less than the difference between the first release time of the target object and the preset length.
[0164] Step 207: Determine the difference between the first release time and the updated first reference time as the first release time information of the target object, and store the first release time information.
[0165] Understandably, if we want to ensure that the data length of the updated first difference is less than or equal to the preset length, then the difference between the first release time and the updated first reference time is less than or equal to the preset length, and the updated first reference time is greater than or equal to the difference between the first release time and the preset length.
[0166] In this specific implementation, to avoid frequent adjustments to the base time and to prevent the stored difference from occupying excessive storage space, this application uses a preset length of 2 * preset masking period as an example. For instance, if the preset masking period is 1 day, the maximum difference is 2 days (72000 seconds, which is 101010001100000000 in binary), occupying 18 bits of storage space. In practical applications, the preset length can be specifically set according to the actual situation. This application does not limit this.
[0167] In practical applications, when object identification information is added to the Cuckoo filter, the corresponding bucket index is determined based on this identification information. The difference between the identification information and the reference time corresponding to the bucket index and the object's release time is then determined. If the difference is greater than 2 * a preset masking period (meaning the difference between the release time and the reference time is greater than 2 * a preset masking period, or the difference between the current time and the reference time is greater than a preset masking period), the reference time corresponding to the bucket index is adjusted so that the difference corresponding to the identification information is less than or equal to 2 * a preset masking period. Therefore, the relationship between the updated reference time and the current time is t. 更新基准 >=t 当前 -w.
[0168] When t 更新基准 =t 当前 When using the -w option, it ensures that the difference calculated when adding object identification information is stored correctly. In practical applications, to ensure that the difference corresponding to the identification information of objects added after the object's identification information is added is also stored correctly, t is usually used. 更新基准 >t 当前 -w, for example, the updated base time can be the current time, or it can be the sum of the current time and the preset blocking period. This application does not specifically limit this.
[0169] Then, the first release time of the target object is adjusted according to the updated first reference time, and the release time information used to indicate the first release time is adjusted accordingly, and the updated release time information is stored. Specifically, the difference between the first release time and the updated first reference time is determined as the first release time information of the target object, and the first release time information is stored.
[0170] This technology allows for the adjustment of the base time set at the storage location corresponding to the difference when the calculated difference exceeds the length of data that can be stored. This ensures that the adjusted difference can be stored normally. By dynamically adjusting the base time corresponding to the storage location of the cuckoo filter, storage requirements can be dynamically met even when the storage space occupied in the cuckoo filter is relatively small.
[0171] Understandably, since the first reference time corresponds to multiple storage locations in the cuckoo filter, after the first reference time is adjusted, the differences stored in other storage locations using the first reference time are also adjusted accordingly. Therefore, after "updating the first reference time" in step 206, the object recommendation method provided in this application further includes the following steps:
[0172] For a second storage location that corresponds to the first reference time, if the second storage location stores second release time information, then the second release time indicated by the second release time information is determined based on the first reference time and the second release time information. If the second release time is greater than the current time, then the second release time information is updated based on the second release time and the updated first reference time.
[0173] This step updates the second release time information stored in a second storage location that corresponds to the same first reference time as the first storage location. In practical applications, there may be multiple second storage locations, some of which may contain data, while others may not. When a second storage location contains data, the stored data includes the second release time information. In this step, the second release time information stored in the second storage location where data is stored is updated.
[0174] First, determine the second release time indicated by the second release time information currently stored in the second storage location where the data is stored. Since the second release time information is the difference between the second release time corresponding to the object to which the identification information stored in the second storage location belongs and the reference time corresponding to the second storage location, and the reference time corresponding to the second storage location is the first reference time, in this step, the sum of the second release time information and the first reference time can be determined as the second release time.
[0175] Subsequently, if the recalculated second release time is greater than the current time, the corresponding object is still within the masking period, and the second release time information of that object stored in the Cuckoo Filter is updated. Specifically, the sum of the second release time and the updated first reference time is determined as the updated second release time information.
[0176] The following formula (1) is the calculation formula for the updated second release time information:
[0177] t 更新后第二解除信息 =t 第二解除 -t 更新后第一基准 =t 第二解除信息 +t 第一基准 -t 更新后第一基准 Formula (1)
[0178] Among them, t 更新后第二解除信息 For the updated second release time information, t 第二解除 For the second release time, t 更新后第一基准 For the updated first reference time, t 第二解除信息 For the second release time information, t 第一基准 This is the first reference time.
[0179] Furthermore, when adjusting the first reference time, the release time indicated by the release time information stored in the corresponding storage location may have already arrived. To promptly delete object data corresponding to unmasked objects, thereby reducing the storage pressure on the Cuckoo Filter, and to ensure timely recommendation of objects not within the masking period during object recommendation, in practical applications, each time data is stored, after determining the storage location based on the object's identification information, the reference time corresponding to that storage location can be obtained, and the data stored in the storage location of the bucket corresponding to that reference time can be queried to see if the release time has arrived.
[0180] Therefore, the object recommendation method provided in this application further includes: if the second release time is less than or equal to the current time, then delete the data stored in the second storage location.
[0181] Understandably, when the second release time information in the second storage location corresponding to the first reference time is adjusted, the calculated second release time may be less than or equal to the current time. This means that the object to which the identification information stored in the second storage location belongs has already qualified for recommendation to the target user, and the stored data is then deleted from the second storage location.
[0182] For example: If the base time A is adjusted on February 10, 2023, and the deactivation time of object 1 corresponding to the identification information stored in storage location B using base time A is February 9, 2023, then it means that object 1 was eligible for recommendation to the target user on February 10, 2023. Therefore, the data stored in storage location B should be deleted.
[0183] When the first reference time is adjusted to the current time, that is, the updated first reference time is the added time, the updated second release time information is calculated using the following formula (2):
[0184] t 更新后第二解除信息 =t 第二解除信息 +t 第一基准 -t 更新后第一基准 =t 第二解除信息 +t 第一基准 -t 当前 Formula (2)
[0185] Among them, t 更新后第二解除信息 For the updated second release time information, t 第二解除 For the second release time, t 更新后第一基准 For the updated first reference time, t 第二解除信息 For the second release time information, t 第一基准 As the first reference time, t 当前 At the current time.
[0186] If the updated first base time is the current time, and you want to delete data that has reached its release time (i.e., delete data whose second release time, as indicated by the updated second release time information, is less than the current time), this can also be determined using the updated second release time information. Because when t... 更新后第二解除 <=t 当前 , t 更新后第二解除 =t 更新后第二解 remove 信息 +t 更新后第一基准 Therefore, t 更新后第二解除信息 +t 更新后第一基准 <=t 当前 , due to t 更新后第一基准 =t 当前 Therefore t 更新后第二解除信息 <= 0. That is, when the first reference time is adjusted to the current time, if the updated second release time information is less than 0, the data stored in the corresponding storage location will be deleted.
[0187] The following combination Figure 4 The updating of the reference time and the deletion of data in the storage location in the data structure filter provided in the embodiments of this application are explained.
[0188] Figure 4 This is a comparative diagram of the data structure filter provided in this application before and after the adjustment of the base time. As shown in interface 4-a, the base time corresponding to buckets 0 to 7 is 1000. The object identification information f(x) is added at the current time 2700. The preset masking period is 1000, so the release time is 3700. The bucket index determined according to the object identification information f(x) is 2 and 4. Therefore, f(x) can be stored in any storage location in bucket 2 and bucket 4. The corresponding release time information is 2700, which exceeds the storage range of 2 * preset masking period (2000). Therefore, the base time is adjusted.
[0189] As shown in interface 4-b, the base time in buckets 0 to 7 has been adjusted from 1000 to the current time 2700. Therefore, the release time information corresponding to the object's identification information f(x) is adjusted to 1000. The release time information stored in buckets 0 to 7 is adjusted so that the release time information corresponding to f1 is adjusted to 100, the release time information corresponding to f2 is adjusted to -1200, and the release time information corresponding to f3 is adjusted to -1000. The release time corresponding to f1 is 2800, the release time corresponding to f2 is 1500, and the release time corresponding to f3 is 1700. Therefore, at the current time 2700, the objects to which the identification information f2 belongs and the objects to which the identification information f3 belongs have reached their release time. The data in the storage locations corresponding to f2 and f3 is deleted, and the corresponding storage space is released.
[0190] This technology allows for the timely deletion of data corresponding to objects that are no longer within the blocking period when adjusting the release time information stored in the corresponding location in the Cuckoo Filter based on the updated baseline time. This enables the data stored in the Cuckoo Filter to accurately reflect whether the object is eligible for recommendation and to release the storage space of the Cuckoo Filter in a timely manner.
[0191] In addition, this application can detect the release time information of the data stored in the cuckoo filter in real time or according to a preset period. When it is detected that the release time indicated by a certain release time information is less than or equal to the current time, the data corresponding to the release time information is deleted.
[0192] Therefore, the deletion strategy for deleting data that has reached the release time in this application can include the following three types:
[0193] Deletion Strategy 1: When adding data to the Cuckoo Filter, during the transfer of data already stored in the Cuckoo Filter, if the release time of the data to be transferred is less than or equal to the current time, then the data will be deleted.
[0194] Deletion Strategy 2: When adding data to a storage location A in the Cuckoo Filter, if the difference calculated based on the existing reference time of storage location A exceeds a preset length, the reference time is adjusted. When adjusting the difference stored in storage locations in the Cuckoo Filter that use the same reference time as storage location A, if the release time corresponding to a certain storage location B is less than or equal to the current time, the data stored in storage location B is deleted.
[0195] Deletion Strategy 3: Detect the release time information of the data stored in the Cuckoo Filter in real time or according to a preset period. When it is detected that the release time indicated by a certain release time information is less than or equal to the current time, delete the data corresponding to that release time information.
[0196] Corresponding to the object recommendation method provided in the first embodiment of this application, the second embodiment of this application also provides an object recommendation apparatus, such as... Figure 5 As shown, the object recommendation device 500 includes:
[0197] The acquisition unit 501 is used to acquire the identification information of the target object in response to an instruction to determine whether the target object is qualified for recommendation for the target user.
[0198] The determining unit 502 is used to determine a first storage location in a preset data structure filter based on the identification information of the target object. The data structure filter includes multiple storage locations, which are used to store the identification information of the first object that has been recommended to the target user and the deactivation time information for re-recommending the first object.
[0199] The reading unit 503 is used to read data from the first storage location.
[0200] The recommendation unit 504 is configured to, when reading data from the first storage location, determine that the target object is qualified to be recommended to the target user if the read data includes the identification information of the target object and the first release time indicated by the release time information in the read data is less than or equal to the current time, and recommend the target object to the target user.
[0201] Optionally, the determining unit 502 is further configured to: determine that the target object is qualified to be recommended to the target user when no data is read from the first storage location, or when data is read from the first storage location but the read data does not include the identification information of the target object, and recommend the target object to the target user.
[0202] The object recommendation device 500 further includes a storage unit 505, which is used to: store the identification information of the target object in the first storage location, and store the first release time information of the target object.
[0203] Optionally, the determining unit 502 is further configured to: when reading data from the first storage location, if the read data includes the identification information of the target object, and the release time indicated by the release time information in the read data is greater than the current time, then determine that the target object does not have the qualification to be recommended to the target user.
[0204] Optionally, the storage unit 505 is specifically used to: determine the sum of the current time and a preset blocking period as the first release time of the target object, wherein the preset blocking period is used to indicate the duration for which the object no longer has the qualification to be recommended after being recommended to the user; obtain the first reference time corresponding to the first storage location; wherein the storage location in the data structure filter is provided with a reference time, and the same reference time corresponds to at least two storage locations; when the data length of the first difference between the first release time and the first reference time is less than or equal to a preset length, determine the first difference as the first release time information of the target object, and store the first release time information.
[0205] Optionally, the object recommendation device 500 further includes an update unit 506, which is configured to: update the first reference time when the data length of the first difference between the first release time and the first reference time is greater than the preset length, so that the updated first reference time is not less than the difference between the first release time of the target object and the preset length.
[0206] The determining unit 502 is further configured to: determine the difference between the first release time and the updated first reference time as the first release time information of the target object, and store the first release time information.
[0207] Optionally, the determining unit 502 is further configured to: for a second storage location that corresponds to the first reference time in the same way as the first storage location, if the second storage location stores second release time information, then determine the second release time indicated by the second release time information based on the first reference time and the second release time information.
[0208] The updating unit 506 is further configured to: if the second release time is greater than the current time, update the second release time information according to the second release time and the updated first reference time.
[0209] Optionally, the object recommendation device 500 further includes a deletion unit 507, which is used to delete the data stored in the second storage location if the second release time is less than or equal to the current time.
[0210] Optionally, the storage unit 505 is specifically used for: storing the identification information and release time information of the target object in the free space of each of the first storage locations when there is a free space in each of the first storage locations; selecting a target first storage location from each of the first storage locations when there is no free space in each of the first storage locations, and checking whether there is a free space in the data structure filter; if there is a free space in the data structure filter, transferring the identification information and release time information of the second object stored in the target first storage location, and storing the identification information and release time information of the target object in the target first storage location.
[0211] Optionally, the storage unit 505 is specifically used to: take the second object as the initial object to be transferred, and repeatedly execute the following first step within a preset number of times to find whether there is a free position in the data structure filter; the first step includes: determining a third storage position in the data structure filter according to the identification information of the object to be transferred; searching for a free position in each of the third storage positions; if a free position is found in each of the third storage positions, then ending the loop; transferring the identification information and release time information of the second object to the free position in each of the third storage positions determined based on the identification information of the second object.
[0212] Optionally, the storage unit 505 is further configured to: if no free location is found in each of the third storage locations, determine the object stored in the target third storage location in the third storage location as the object to be transferred, and return to execute the first step until a free location is found in the data structure filter, and end the loop; for each object to be transferred in the loop process of the first step, transfer the identification information and release time information of the object to be transferred to the free location in each of the third storage locations determined based on the identification information of the object to be transferred.
[0213] Optionally, the storage unit 505 is further configured to: if the execution count of the first step reaches the preset number and no free position is found, determine that there is no free position in the data structure filter and end the loop; if there is no free position in the data structure filter, delete object data whose release time is close to the current time to generate a free position in the data structure filter; transfer the identification information and release time information of the second object stored in the target first storage location, and store the identification information and release time information of the target object in the target first storage location.
[0214] Optionally, the storage unit 505 is further configured to: cyclically execute the first step within a first number of transfers; if there are no free positions in the data structure filter, for each object to be transferred during the cyclic process of the first step within the first number of transfers, obtain the release time information corresponding to each object to be transferred; when the cyclic count of the first step reaches the first number of transfers, stop the cyclic process; if the release time indicated by the release time information corresponding to each object to be transferred is greater than the current time, determine the minimum release time from the release times indicated by the release time information corresponding to each object to be transferred; cyclically execute the first step within a second number of transfers, obtain the release time information of the object to be transferred corresponding to each transfer; if the release time indicated by the release time information of the object to be transferred corresponding to the i-th transfer is less than the minimum release time, delete the object identifier and release time information of the object to be transferred corresponding to the i-th transfer, and stop the cyclic process; wherein, the sum of the first number of transfers and the second number of transfers is not greater than the preset number of transfers.
[0215] Optionally, the storage unit 505 is further configured to: if the release time indicated by the release time information of each object to be transferred in the loop process of the first step within the second transfer count is greater than or equal to the minimum release time, then delete the object identifier and release time information of the object to be transferred corresponding to the minimum release time, and stop the loop when the loop count of the first step reaches the second transfer count.
[0216] Optionally, the update unit 506 is further configured to: update the release time information corresponding to the target object stored in the first storage location according to the current time and the preset blocking period.
[0217] Corresponding to the object recommendation method provided in the first embodiment of this application, the third embodiment of this application also provides an electronic device for object recommendation. For example... Figure 6 As shown, the electronic device includes: a processor 601; and a memory 602 for storing a program for an object recommendation method. After the device is powered on and the program for the object recommendation method is run by the processor, the following steps are performed:
[0218] In response to an instruction to determine whether a target object is qualified for recommendation for a target user, the identifier information of the target object is obtained;
[0219] Based on the identification information of the target object, a first storage location is determined in a preset data structure filter. The data structure filter includes multiple storage locations, which are used to store the identification information of the first object that has been recommended to the target user and the deactivation time information for re-recommending the first object.
[0220] Data is read from the first storage location;
[0221] If data is read from the first storage location, and the read data includes the identification information of the target object, and the first release time indicated by the release time information in the read data is less than or equal to the current time, then it is determined that the target object is qualified to be recommended to the target user, and the target object is recommended to the target user.
[0222] Corresponding to the object recommendation method provided in the first embodiment of this application, the fourth embodiment of this application provides a computer-readable storage medium storing a program for the object recommendation method, which is executed by a processor to perform the following steps:
[0223] In response to an instruction to determine whether a target object is qualified for recommendation for a target user, the identifier information of the target object is obtained;
[0224] Based on the identification information of the target object, a first storage location is determined in a preset data structure filter. The data structure filter includes multiple storage locations, which are used to store the identification information of the first object that has been recommended to the target user and the deactivation time information for re-recommending the first object.
[0225] Data is read from the first storage location;
[0226] If data is read from the first storage location, and the read data includes the identification information of the target object, and the first release time indicated by the release time information in the read data is less than or equal to the current time, then it is determined that the target object is qualified to be recommended to the target user, and the target object is recommended to the target user.
[0227] It should be noted that for a detailed description of the apparatus, electronic device and computer-readable storage medium provided in the second, third and fourth embodiments of this application, please refer to the relevant description of the first embodiment of this application, which will not be repeated here.
[0228] Although this application discloses preferred embodiments as described above, it is not intended to limit this application. Any person skilled in the art can make possible changes and modifications without departing from the spirit and scope of this application. Therefore, the scope of protection of this application should be determined by the scope defined in the claims of this application.
[0229] In a typical configuration, a node device in a blockchain includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0230] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0231] 1. Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage media, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include non-transitory computer-readable media, such as modulated data signals and carrier waves.
[0232] 2. Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0233] Although this application discloses preferred embodiments as described above, it is not intended to limit this application. Any person skilled in the art can make possible changes and modifications without departing from the spirit and scope of this application. Therefore, the scope of protection of this application should be determined by the scope defined in the claims of this application.
Claims
1. An object recommendation method, characterized in that, The method includes: In response to an instruction to determine whether a target object is qualified for recommendation for a target user, the identifier information of the target object is obtained; Based on the identification information of the target object, a first storage location is determined in a preset data structure filter. The data structure filter includes multiple storage locations, which are used to store the identification information of the first object that has been recommended to the target user and the deactivation time information for re-recommending the first object. Data is read from the first storage location; If data is read from the first storage location, and the read data includes the identification information of the target object, and the first release time indicated by the release time information in the read data is less than or equal to the current time, then it is determined that the target object is qualified to be recommended to the target user, and the target object is recommended to the target user. The method further includes: The first release time information of the target object is stored in the first storage location; The storage of the first release time information of the target object includes: The sum of the current time and the preset blocking period is determined as the first unblocking time of the target object, wherein the preset blocking period is used to indicate the duration for which the object no longer has the qualification to be recommended after being recommended to the user; Obtain the first reference time corresponding to the first storage location; wherein, the storage locations in the data structure filter are provided with reference times, and the same reference time corresponds to at least two storage locations; If the data length of the first difference between the first release time and the first reference time is greater than the preset length, the first reference time is updated so that the updated first reference time is not less than the difference between the first release time of the target object and the preset length. The difference between the first release time and the updated first reference time is determined as the first release time information of the target object, and the first release time information is stored.
2. The method according to claim 1, characterized in that, The method further includes: If no data is read from the first storage location, or if data is read from the first storage location but the read data does not include the identification information of the target object, it is determined that the target object is qualified to be recommended to the target user, and the target object is recommended to the target user. The identification information of the target object is stored in the first storage location.
3. The method according to claim 1, characterized in that, The method further includes: If, when data is read from the first storage location, the read data includes the identification information of the target object, and the release time indicated by the release time information in the read data is greater than the current time, then it is determined that the target object does not have the qualification to be recommended to the target user.
4. The method according to claim 1, characterized in that, The storage of the first release time information of the target object also includes: If the data length of the first difference between the first release time and the first reference time is less than or equal to a preset length, the first difference is determined as the first release time information of the target object, and the first release time information is stored.
5. The method according to claim 4, characterized in that, After updating the first reference time, the method further includes: For a second storage location that corresponds to the first reference time in the same way as the first storage location, if the second storage location stores second release time information, then the second release time indicated by the second release time information is determined according to the first reference time and the second release time information. If the second release time is greater than the current time, the second release time information is updated based on the second release time and the updated first reference time.
6. The method according to claim 5, characterized in that, After determining the second release time indicated by the second release time information based on the first reference time and the second release time information, the method further includes: If the second release time is less than or equal to the current time, then the data stored in the second storage location is deleted.
7. The method according to claim 2, characterized in that, When data is read from the first storage location, and the read data does not include the identification information of the target object, storing the identification information of the target object and the first release time information of the target object in the first storage location includes: If each of the first storage locations includes a free location, the identification information and release time information of the target object are stored in the free location of each of the first storage locations; If no free space is available in each of the first storage locations, a target first storage location is selected from each of the first storage locations, and it is checked whether there is a free space in the data structure filter; If there is an empty space in the data structure filter, the identification information and release time information of the second object stored in the first target storage location are transferred, and the identification information and release time information of the target object are stored in the first target storage location.
8. The method according to claim 7, characterized in that, The step of checking whether there are any free positions in the data structure filter includes: Using the second object as the initial object to be transferred, the following first step is executed repeatedly within a preset number of times to find whether there is a free position in the data structure filter; The first step includes: Based on the identification information of the object to be transferred, a third storage location is determined in the data structure filter; Find a free location in each of the third storage locations; If a free location is found in each of the aforementioned third storage locations, the loop ends. The step of transferring the identification information and release time information of the second object stored in the first target storage location includes: The identification information and release time information of the second object are transferred to the free positions in each of the third storage locations determined based on the identification information of the second object.
9. The method according to claim 8, characterized in that, The first step also includes: If no free location is found in any of the third storage locations, the object stored in the target third storage location is identified as the object to be transferred, and the first step is returned to be executed until a free location is found in the data structure filter, and the loop ends. The step of transferring the identification information and release time information of the second data stored at the target first storage location includes: For each object to be transferred in the loop process of the first step, the identification information and release time information of the object to be transferred are transferred to an empty position in each of the third storage locations determined based on the identification information of the object to be transferred.
10. The method according to claim 8, characterized in that, The first step also includes: If the first step is executed a preset number of times and no free position is found, it is determined that there is no free position in the data structure filter, and the loop ends. The method further includes: If there are no free positions in the data structure filter, then object data whose release time is close to the current time will be deleted to create free positions in the data structure filter; The identification information and release time information of the second object stored in the first target storage location are transferred, and the identification information and release time information of the target object are stored in the first target storage location.
11. The method according to claim 10, characterized in that, The deletion of object data whose expiration time is close to the current time includes: The first step is executed repeatedly within the first number of transfers. If there is no free position in the data structure filter, for each object to be transferred in the loop process of the first step within the first number of transfers, the release time information corresponding to each object to be transferred is obtained. When the loop count of the first step reaches the first number of transfers, the loop stops. If the release time indicated by the release time information corresponding to each of the objects to be transferred is greater than the current time, then the minimum release time is determined from the release times indicated by the release time information corresponding to each of the objects to be transferred. The first step is executed repeatedly within the second number of transfers. The release time information of the object to be transferred is obtained for each transfer. If the release time indicated by the release time information of the object to be transferred at the i-th transfer is less than the minimum release time, the identification information and release time information of the object to be transferred at the i-th transfer are deleted, and the loop stops. The sum of the first number of transfers and the second number of transfers is not greater than the preset number.
12. The method according to claim 11, characterized in that, The method further includes: If the release time indicated by the release time information of each object to be transferred in the first step of the second transfer count is greater than or equal to the minimum release time, then the identification information and release time information of the object to be transferred corresponding to the minimum release time are deleted. When the number of cycles in the first step reaches the second transfer count, the cycle stops.
13. The method according to claim 1, characterized in that, After recommending the target object to the target user, the method further includes: Based on the current time and the preset blocking period, update the release time information corresponding to the target object stored in the first storage location.
14. An object recommendation device, characterized in that, The device includes: The acquisition unit is used to acquire the identification information of the target object in response to an instruction to determine whether the target object is qualified for recommendation for the target user; The determining unit is configured to determine a first storage location in a preset data structure filter based on the identification information of the target object, wherein the data structure filter includes multiple storage locations, and the storage locations are used to store the identification information of the first object that has been recommended to the target user and the deactivation time information for re-recommending the first object; A reading unit is used to read data from the first storage location; The recommendation unit is configured to, when reading data from the first storage location, determine that the target object is qualified to be recommended to the target user if the read data includes the identification information of the target object and the first release time indicated by the release time information in the read data is less than or equal to the current time, and recommend the target object to the target user. The determining unit is further configured to: The first release time information of the target object is stored in the first storage location; The storage of the first release time information of the target object includes: The sum of the current time and the preset blocking period is determined as the first unblocking time of the target object, wherein the preset blocking period is used to indicate the duration for which the object no longer has the qualification to be recommended after being recommended to the user; Obtain the first reference time corresponding to the first storage location; wherein, the storage locations in the data structure filter are provided with reference times, and the same reference time corresponds to at least two storage locations; If the data length of the first difference between the first release time and the first reference time is greater than the preset length, the first reference time is updated so that the updated first reference time is not less than the difference between the first release time of the target object and the preset length. The difference between the first release time and the updated first reference time is determined as the first release time information of the target object, and the first release time information is stored.
15. An electronic device, characterized in that, include: processor; as well as A memory for storing a data processing program, which, when the electronic device is powered on and runs through the processor, executes the method as described in any one of claims 1-13.
16. A computer-readable storage medium, characterized in that, The system contains a data processing program that is executed by a processor to perform the method as described in any one of claims 1-13.