WO2021087970A1 - Method and apparatus for updating tag data, electronic device, and storage medium - Google Patents

Method and apparatus for updating tag data, electronic device, and storage medium Download PDF

Info

Publication number
WO2021087970A1
WO2021087970A1 PCT/CN2019/116679 CN2019116679W WO2021087970A1 WO 2021087970 A1 WO2021087970 A1 WO 2021087970A1 CN 2019116679 W CN2019116679 W CN 2019116679W WO 2021087970 A1 WO2021087970 A1 WO 2021087970A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
tag data
type
update
update queue
Prior art date
Application number
PCT/CN2019/116679
Other languages
French (fr)
Chinese (zh)
Inventor
黄江伟
Original Assignee
深圳市欢太科技有限公司
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市欢太科技有限公司, Oppo广东移动通信有限公司 filed Critical 深圳市欢太科技有限公司
Priority to CN201980100127.1A priority Critical patent/CN114365111A/en
Priority to PCT/CN2019/116679 priority patent/WO2021087970A1/en
Publication of WO2021087970A1 publication Critical patent/WO2021087970A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating

Definitions

  • This application relates to the field of data processing technology, and more specifically, to a method, device, electronic device, and storage medium for updating tag data.
  • this application proposes a method, device, electronic device and storage medium for updating tag data.
  • an embodiment of the present application provides a method for updating label data.
  • the method includes: when the label data to be updated is obtained, the type of the label data is obtained, and different types of label data are updated in real time. Different levels of sexuality; cache the tag data in the update queue corresponding to the type, where different update queues correspond to different data update speeds; according to the data update speed corresponding to the update queue, all data in the update queue The label data is updated.
  • an embodiment of the present application provides a device for updating tag data.
  • the device includes: a type acquisition module, a data caching module, and a data update module.
  • the type acquisition module is used to obtain the tag to be updated. When data is acquired, the type of the tag data is obtained. Different types of tag data have different real-time levels during update; the data caching module is used to cache the tag data to the update queue corresponding to the type, where different The update queue corresponds to different data update speeds; the data update module is used to update the tag data in the update queue according to the data update speed corresponding to the update queue.
  • an embodiment of the present application provides an electronic device, including: one or more processors; a memory; one or more application programs, wherein the one or more application programs are stored in the memory and It is configured to be executed by the one or more processors, and the one or more programs are configured to execute the method for updating tag data provided in the first aspect described above.
  • an embodiment of the present application provides a computer-readable storage medium.
  • the computer-readable storage medium stores program code, and the program code can be called by a processor to execute the tag provided in the first aspect. How to update the data.
  • the solution provided by this application obtains the type of label data when obtaining the label data to be updated. Different types of label data have different real-time levels when updating, and then caches the label data to the update queue corresponding to the type. Update the data update speed corresponding to the update queue, update the tag data in the update queue, so as to realize that the tag data of different real-time levels can be entered into different update queues, and the tags are updated according to the data update speed corresponding to the update queue. The data is updated to ensure the real-time update of label data.
  • Fig. 1 shows a schematic diagram of the principle of tag data update provided by an embodiment of the present application.
  • Fig. 2 shows a flowchart of a method for updating tag data according to an embodiment of the present application.
  • Fig. 3 shows a flowchart of a method for updating tag data according to another embodiment of the present application.
  • FIG. 4 shows a flowchart of step S210 in the method for updating tag data provided by another embodiment of the present application.
  • FIG. 5 shows another flowchart of step S210 in the method for updating tag data provided by another embodiment of the present application.
  • FIG. 6 shows a schematic diagram of the principle of a method for updating tag data provided by another embodiment of the present application.
  • Fig. 7 shows a flowchart of a method for updating tag data according to another embodiment of the present application.
  • Fig. 8 shows a flowchart of a method for updating tag data according to another embodiment of the present application.
  • FIG. 9 shows a flowchart of step S430 in the method for updating tag data according to another embodiment provided by the present application.
  • FIG. 10 shows another flow chart of step S430 in the method for updating tag data in another embodiment provided by the present application.
  • Fig. 11 shows a block diagram of a device for updating tag data according to an embodiment of the present application.
  • Fig. 12 shows a block diagram of the type acquisition module in the device for updating tag data according to an embodiment of the present application.
  • Fig. 13 shows another block diagram of the type acquisition module in the device for updating tag data according to an embodiment of the present application.
  • FIG. 14 is a block diagram of an electronic device for executing the method for updating tag data according to an embodiment of the present application according to an embodiment of the present application.
  • Fig. 15 is a storage unit for storing or carrying program code implementing the method for updating tag data according to the embodiment of the present application according to an embodiment of the present application.
  • information recommendation technology based on big data technology can recommend content that people need, which can better meet the needs of users.
  • people can use the Internet to shop, entertain, and publish personal status information (for example, Weibo), etc.
  • Merchants can obtain people’s consumption, entertainment, and personal status information through the Internet, which can provide a more comprehensive understanding of the public’s information.
  • User tags are mainly data used to reflect information such as users' social attributes, living habits, and consumption behaviors, and user tags are feature identifiers obtained by analyzing user information. The user tag continuously updates the tag data, so that the user tag can ensure accuracy.
  • tag data is mainly stored in a database
  • electronic devices that manage user tags usually collect tag data from different data sources and write the tag data into the tag database.
  • the data source can be a server, a mobile terminal, etc., which is not limited here.
  • the tag data update in the traditional technology usually processes all tag data in a unified manner.
  • the data is offline processed, and after all the data is offline calculated, the storage or update request is uniformly initiated to the tag management system. In this way, when a large amount of data is updated, it can efficiently perform aggregation processing and reduce the pressure on the label management system.
  • the inventors proposed the method, device, electronic device and storage medium for updating tag data provided by the embodiments of the present application.
  • the tag data to be updated is obtained, the tag data is cached according to the type of the tag data.
  • the update queue corresponds to its type, and the tag data is updated according to the data update speed corresponding to the update queue to ensure the real-time update of the tag data.
  • the specific method for updating the tag data will be described in detail in the subsequent embodiments.
  • FIG. 2 shows a schematic flowchart of a method for updating tag data provided by an embodiment of the present application.
  • the tag data update method is used to realize that tag data of different real-time levels can be entered into different update queues, and the tag data is updated according to the data update speed corresponding to the update queue to ensure the real-time update of tag data Sex.
  • the tag data updating method is applied to the tag data updating device 400 as shown in FIG. 11 and the electronic device 100 configured with the tag data updating device 400 (FIG. 14 ).
  • FIG. 14 shows a schematic flowchart of a method for updating tag data provided by an embodiment of the present application.
  • the tag data update method is used to realize that tag data of different real-time levels can be entered into different update queues, and the tag data is updated according to the data update speed corresponding to the update queue to ensure the real-time update of tag data Sex.
  • the tag data updating method is applied to the tag data updating device 400 as shown in FIG. 11 and the electronic device 100 configured with the tag data updating device 400 (
  • Step S110 When the tag data to be updated is obtained, the type of the tag data is obtained, and different types of tag data have different real-time levels when being updated.
  • the electronic device can manage the user's tag data, and the tag data managed by the electronic device can come from a data source.
  • the data source may be a server, or a mobile terminal, etc., which is not limited here.
  • the electronic device can obtain the label data from the data source to update the user's label data.
  • the label data refers to data corresponding to the label, and specifically may be user data corresponding to the label.
  • the occupation of user A at the first moment is a student
  • the occupation at the second moment is a teacher.
  • the data corresponding to the occupation in the label of user A is student.
  • the label of user A The data corresponding to the middle occupation is teachers. Since the user’s label data is changing over time, it is necessary to continuously update the user’s label data so that the user’s label data can match the user’s latest status, so as to provide users with the ability to meet their needs based on the label data. Service.
  • the electronic device may actively obtain the tag data to be updated from the data source, or may receive the tag data to be updated sent by the data source.
  • the label data to be updated refers to the obtained label data that needs to be written into the label data database, and can also be understood as the label data used to update the user label.
  • the electronic device may obtain the tag data to be updated from the data source regularly or irregularly. For example, the electronic device may obtain the tag data to be updated from the data source at a preset interval. For another example, the electronic device may receive the tag data to be updated from the data source in real time.
  • the electronic device when it obtains the tag data to be updated, it can determine the type of the tag data to be updated.
  • Different types of label data have different real-time levels when they are updated.
  • the real-time level of label data when it is updated can refer to the level of real-time demand for label data when it is updated. The higher the real-time level, the higher the real-time level of the label data. The more real-time updates are needed.
  • the types of tag data include type A, type B, and type C.
  • the tag data of type A, type B, and type C have different real-time levels.
  • the tag data of type A can have a higher real-time level than type C.
  • the real-time level corresponding to the label data of B can be greater than the real-time level corresponding to the label data of type C.
  • the above is only an example, and does not represent the specific type and real-time Limitation of the level of relationship.
  • the type of label data may be the classification result of different label data classified in advance according to the real-time level corresponding to the label data.
  • Each classification result may correspond to a type and belong to the same type.
  • the real-time level corresponding to the tag data can be the same.
  • the user’s location, the user’s web browsing information, etc. have very strong real-time requirements for updating, and its real-time level is at the first level, then the location, web browsing information, etc. can be used as a type; the user’s dining and consumption Amount, etc., have a strong demand for real-time during update, and its real-time level is at the second level, so the user’s meal, consumption amount, etc.
  • the user’s occupation, age, etc. do not have a strong demand for real-time during update , Its real-time level is at the third level, the user’s occupation, age, etc. can be used as a type, where the first level, the second level, and the third level are in descending order.
  • the above is only For example, it does not represent a limitation on specific types.
  • the type of tag data can be pre-stored in the electronic device, and the electronic device can determine the type of tag data by identifying the field data in the tag data, the data source of the source, the user identification, etc., which is not limited here.
  • Step S120 Buffer the tag data in the update queue corresponding to the type, where different update queues correspond to different data update speeds.
  • a plurality of update queues may be pre-created in the memory of the electronic device, and the update queues are used to cache tag data to be updated.
  • each update queue corresponds to a type of tag data
  • the data update speed corresponding to each update queue is different
  • the number of update queues is the same as the number of types
  • the specific number of update queues is not limited.
  • the types corresponding to the tag data include the first type, the second type, and the third type
  • three update queues can be created in advance in the electronic device, and the three update queues correspond to the first type, the second type, and the third type, respectively.
  • the data update speed corresponding to the update queue may refer to the speed in the subsequent process of taking out the tag data from the update queue and updating it.
  • the data update speed corresponding to the update queue may correspond to the corresponding type of tag data.
  • the real-time level during the update corresponds to, so that the update queue can meet the real-time requirements of the corresponding type of tag data during the update.
  • the higher the real-time level of the tag data corresponding to the update queue the faster the data update speed corresponding to the update queue, thereby ensuring that the tag data with high real-time level can be updated quickly and ensuring the timeliness of the tag data Sex.
  • the electronic device after the electronic device determines the type corresponding to the tag data to be updated, it can determine the update queue corresponding to the type from a plurality of pre-created update queues according to the type corresponding to the tag data.
  • the update queue corresponding to this type determined by the electronic device is used to cache the obtained tag data.
  • the electronic device may cache the tag data obtained in step S110 in the update queue corresponding to this type, so as to subsequently update the obtained tag data .
  • the data update speed corresponding to different update queues can be controlled according to the speed of fetching tag data from the update queue and the speed of updating the tag data to the tag database.
  • the specific implementation of different update queues corresponding to different update speeds may not be regarded as a limitation.
  • Step S130 Update the tag data in the update queue according to the data update speed corresponding to the update queue.
  • the tag data in the update queue can be updated according to the data update speed corresponding to the update queue, so that the obtained tag data is updated
  • the speed corresponds to its corresponding real-time level.
  • the higher the real-time level of the tag data corresponding to the update queue the faster the data update speed corresponding to the update queue, so that the tag data with high real-time level can be updated quickly, ensuring the timeliness of the tag data .
  • the tag data with high real-time level can be updated quickly, ensuring the timeliness of the tag data .
  • the tag data with high real-time level can be updated quickly, ensuring the timeliness of the tag data .
  • not all the update speeds of the update queues in the electronic device correspond to the higher data update speed.
  • the label data with low real-time level it will enter To the update queue with a relatively slow data update speed, instead of all tag data entering the update queue with a relatively fast data update speed, the resources of the electronic device will not be occupied by too many resources by the update task of the tag data, which is effective Utilizes the resources of electronic equipment.
  • the method for updating tag data determines the type of tag data when obtaining tag data to be updated, then caches the tag data in the update queue corresponding to the type, and then according to the data corresponding to the update queue Update speed, update the label data in the update queue, so that the speed at which the obtained label data is updated corresponds to the corresponding real-time level, so that the label data with high real-time level can be updated quickly, ensuring the label Timeliness of data.
  • FIG. 3 shows a schematic flowchart of a method for updating tag data provided by another embodiment of the present application. This method is applied to the above-mentioned electronic equipment. The process shown in FIG. 3 will be described in detail below.
  • the method for updating label data may specifically include the following steps:
  • Step S210 When the tag data to be updated is obtained, the type of the tag data is obtained, and different types of tag data have different real-time levels when being updated.
  • the type of the tag data may correspond to the type identification of the tag data, or it may correspond to the data source of the tag data.
  • the electronic device obtains the type of tag data, it can be determined according to the type identification of the tag data or the data source corresponding to the tag data.
  • each tag data may include a three-segment identification, the three-segment identification is composed of an identification a, an identification b, and an identification c, and the identification a may be used to indicate the large Category (for example, category includes personal type and family type), the identifier b is used to indicate the type corresponding to the real-time level, the type corresponding to the real-time level can be determined by the identifier b, and the identifier c can be used to indicate the label name.
  • the types of tag data are divided into a first type and a second type, b1 can represent the first type, and b2 can represent the second type.
  • the above is only an example, and does not represent a limitation on the actual type identification.
  • step S210 may include:
  • Step S211A Obtain a type identifier in the tag data, where the type identifier is used to characterize the type of tag data;
  • Step S212A Determine the type of the tag data according to the type identification.
  • the tag data may include a type identification.
  • the type identification is in the setting field of the label data.
  • the electronic device can obtain the type identification of the label data by obtaining the data of the setting field in the label data. After the electronic device obtains the type identification of the label data, it can identify according to the type, Determine the type of label data.
  • step S210 may include:
  • Step S211B Obtain the data source of the tag data
  • Step S212B Determine the type of the tag data according to the data source.
  • the label data of different data sources may have different real-time levels when they are updated.
  • the real-time level of the label data of the data source when it is updated can refer to the real-time performance of the label data of the data source when it is updated.
  • the demand level the higher the real-time level, the more the label data of the data source needs to be updated in real time.
  • the type of tag data is classified based on the real-time level of tag data when it is updated. Therefore, the type of tag data can be determined according to the data source of the tag data.
  • the corresponding relationship between the identities and types of different data sources can be stored in the electronic device in advance.
  • the electronic device can identify the identity of the data source, etc., after determining the data source, according to the corresponding relationship and the data source’s corresponding relationship. Identification, which determines the type of label data.
  • the types of tag data can be divided into a first type and a second type, and the real-time level corresponding to the first type of tag data may be higher than the real-time level corresponding to the second type of tag data.
  • the first type of label data can be label data that requires high real-time performance when updating label data, and label data with strong immediate effect. If the label data of this type is not updated in real time, it will cause the first label data to be updated.
  • One type of label data loses its function.
  • the first type of label data can be location data, web browsing information, consumption records, web browsing records and other time-sensitive data
  • the second type of label data can be user age, user occupation, user gender and other time-sensitive data. Strong data.
  • Step S220 When the type is the first type, buffer the tag data in the first update queue.
  • the first type may correspond to the first update queue
  • the second type may correspond to the second update queue
  • the data update rate corresponding to the first update queue is the data update rate corresponding to the second update queue. Therefore, if the obtained tag data is of the first type, the tag data can be cached in the first update queue; if the obtained tag data is of the second type, the tag data can be cached in the second update queue.
  • the data update speed corresponding to the first update queue may be greater than the set speed, so that each tag data of the first type takes less time to update, thereby realizing the real-time data of the first type tag.
  • Update The specific value of the setting speed may not be limited.
  • the setting speed may be 2 pieces/minute, that is, two pieces of label data are updated every minute, or the time it takes to update each piece of label data is 30 seconds.
  • step S220 may include: when the type is the first type, determining whether the current amount of data in the first update queue reaches a cache threshold; if the current amount of data does not reach the cache threshold, The tag data is cached in the first update queue.
  • the tag data in the first update queue can be updated in real time
  • the throughput of the first update queue (that is, the amount of cached data) is small, and the tag data in it will be updated quickly, which is suitable for processing small batches.
  • Label data if the amount of data that can be cached in the first update queue is large and the amount of data cached in the first update queue reaches the cache threshold, the tag data at the end of the update queue will not be updated until a long time. , It cannot be updated in real time and loses its timeliness. Therefore, the amount of data that can be cached in the first update queue will not be too large, so as to ensure that the tag data at the end of the queue remains the same when there are more tag data in the first update queue. Can be updated in real time.
  • the second update queue is suitable for large batches of tag data, has a higher throughput, and takes longer to update the tag data.
  • the type of tag data is the first type
  • the current data volume in the first update queue refers to the current data volume of the tag data that has been cached in the first update queue
  • the cache threshold can refer to the data volume that the first update queue can hold, or it can be smaller than the first update queue.
  • the value of the amount of data that the update queue can hold is not limited here.
  • the method for updating tag data may further include: if the current data volume reaches a cache threshold, determining the cache duration of each tag data in the first update queue after being cached in the first update queue; For the first tag data in the first update queue, the buffer duration corresponding to the first tag data is greater than the set duration; after the first tag data is cleared from the first update queue, if the first update The current amount of data in the queue does not reach the cache threshold, and the tag data is cached in the first update queue.
  • the tag data whose cache duration is greater than the set duration can be determined from the first update queue as The first label data.
  • the cache duration of the first tag data is greater than the set duration, which means that the update speed may be slow due to current device factors, so that the first tag data has been cached for a long time without being updated, and the timeliness is lost. Therefore, the first tag data can be cleared from the first update queue, and the tag data to be updated can be cached in the first update queue, so that the tag data to be updated can be updated.
  • the first update queue and the second update queue are located in memory.
  • the method for updating the tag data may further include: buffering the first tag data in the second update queue; or storing the first tag data in the second update queue;
  • the first label data is stored to the local disk. It is understandable that since the first tag data cannot be updated in real time, but in order not to lose the first tag data, the first tag data can still be saved.
  • the first tag data can be cached in the second update queue. , So that the first tag data can be subsequently updated to the tag database, or the first tag data can be stored in a local disk, so as to achieve data retention.
  • the tag data to be updated can be temporarily cached to the local disk or cached in the memory.
  • the tag data to be updated is retrieved and cached in the first update queue, so that the first update queue can still be updated relatively quickly.
  • the method for updating tag data may further include: obtaining a user ID and tag name corresponding to the tag data; determining whether there is second tag data in the first update queue, and the second tag data Identify the tag data of the tag name corresponding to the user; if the second tag data exists in the first update queue, clear the second tag data in the first update queue.
  • Tag data corresponding to the user ID and tag name and determine whether there is tag data (second tag data) that is the same as the user ID and tag name in the first update queue. If there is second tag data, it can be Clear, so as to subsequently update the latest label data with the same name to the label data of the user, so as to avoid updating the second label data that is not up to date and occupy the update time, which improves the speed of label update.
  • the tag data to be updated is the current location data with the user identification as M1
  • the current location data with the user identification as M1 exists in the first update queue
  • the current location data in the first update queue is no longer the user identification as
  • the latest current location data of the user of M1 loses its role as the current location data of the user. Therefore, the current location data of the user identified as M1 in the first update queue can be cleared to improve the tag update speed.
  • Step S230 When the type is the second type, buffer the tag data to the second update queue.
  • the tag data to be updated when the type of the tag data to be updated is the second type, since the second type of tag data does not have a high demand for real-time performance during update, the tag data can be cached in the second update queue. It will not affect the actual function of the label data.
  • Step S240 Update the tag data in the update queue according to the data update speed corresponding to the update queue.
  • step S240 can refer to the content of the foregoing embodiment, which will not be repeated here.
  • FIG. 6 shows a schematic diagram of the principle of a method for updating tag data provided by an embodiment of the present application.
  • tag data with strong timeliness such as geographic location can be identified as the first Type, so as to be cached in the first buffer queue 704, while other tag data with less timeliness can be identified as the second type and cached in the second buffer queue 705, and the first buffer queue corresponds to the first update Program 706, the second buffer queue 705 corresponds to the second update program 707.
  • the update speed of the first update program 706 to the tag data can be greater than the update speed of the second update program 707 to the tag data.
  • the first update program 706 updates the tag data.
  • the update speed can be greater than the set speed, and real-time update of tag data with strong timeliness such as geographic location can be realized.
  • the first update program 706 can be implemented by tools such as Flink, SparkStreaming, Storm, and Samza.
  • the method for updating tag data determines the type of tag data when obtaining tag data to be updated, and then caches the tag data in the first update queue corresponding to the first type, or caches the tag data In the second update queue corresponding to the second type, the tag data in the update queue is updated according to the data update speed corresponding to the update queue. This enables label data with a high real-time level to be updated in real time, ensuring the timeliness of label data.
  • FIG. 7 shows a schematic flowchart of a method for updating tag data provided by another embodiment of the present application.
  • the method for updating label data is applied to the above-mentioned electronic equipment. The following will describe the process shown in FIG. 7 in detail.
  • the method for updating label data may specifically include the following steps:
  • Step S310 When the tag data to be updated is obtained, the type of the tag data is obtained. Different types of tag data have different real-time levels when updating.
  • step S310 can refer to the content of the foregoing embodiment, which will not be repeated here.
  • Step S320 Determine the update queue corresponding to the type, and determine whether the data update speed corresponding to the update queue is greater than the set speed.
  • Step S330 If the data update speed corresponding to the update queue is greater than the set speed, obtain the remaining utilization of the processor.
  • the data update speed corresponding to the update queue is relatively large, the processor resources occupied during the update are also large, and if the remaining resources of the processor are small, the tag data is continuously updated at a relatively large update speed.
  • the update may cause the operation of the electronic device to crash. Therefore, the data update speed corresponding to the update queue can be determined, and when the data update speed corresponding to the update queue is greater than the set speed, the remaining utilization rate of the processor is obtained, so as to determine whether the remaining resources of the processor are at a low level.
  • the tag data to be updated can be cached in the update queue, and the tag data to be updated is subsequently updated.
  • the set speed can be used as a judgment basis for judging whether the label update may cause operation crash, and its specific size may not be used as a limitation.
  • Step S340 If the remaining utilization rate is higher than the set utilization rate, buffer the tag data to the update queue corresponding to the type.
  • the set utilization rate can be used as a basis for judging whether the operation of the electronic device will crash, and the specific size is not limited, for example, it can be 10% or 5%.
  • Step S350 If the remaining utilization rate is less than or equal to the set utilization rate, buffer the tag data to a target update queue, and the data update speed corresponding to the update queue is greater than the data update speed corresponding to the target update queue.
  • the tag data is updated subsequently using the data update speed corresponding to the update queue. It may cause the operation of electronic equipment to crash.
  • the tag data can be cached in a target update queue with a relatively low data update speed to avoid jams and crashes when the tag data is updated.
  • Step S360 Update the tag data in the update queue according to the data update speed corresponding to the update queue.
  • step S360 can refer to the content of the foregoing embodiment, which will not be repeated here.
  • the method for updating tag data determines the type of tag data when obtaining the tag data to be updated, and then the update queue corresponding to the type, and when the update speed of the update queue is greater than the set speed, obtain The remaining utilization rate of the processor. When the remaining utilization rate is greater than the set utilization rate, the tag data to be updated will be cached to the update queue. When the remaining utilization rate is less than or equal to the set utilization rate, the tag data to be updated will be cached. Cache to the target update queue, and then update the tag data in the update queue according to the data update speed corresponding to the update queue. This enables label data with a high real-time level to be updated in real time, guarantees the timeliness of the label data, and avoids the crash of the electronic device during operation.
  • FIG. 8 shows a schematic flowchart of a method for updating tag data provided by another embodiment of the present application.
  • the method for updating label data is applied to the above-mentioned electronic equipment. The following will describe the process shown in FIG. 8 in detail.
  • the method for updating label data may specifically include the following steps:
  • Step S410 When the tag data to be updated is obtained, the type of the tag data is obtained. Different types of tag data have different real-time levels when updating.
  • Step S420 Buffer the tag data in the update queue corresponding to the type, where different update queues correspond to different data update speeds.
  • step S410 and step S420 can refer to the content of the foregoing embodiment, which will not be repeated here.
  • Step S430 If the type is the set type, sort all the tag data according to the type of each tag data of all the tag data in the update queue.
  • the update queue can correspond to multiple types of tag data, that is, the electronic device can cache tag data with different real-time levels in the same update queue.
  • the electronic device can have update queue 1 and update queue 2, and the real-time level corresponding to the tag data is divided into real-time level 1, real-time level 2, real-time level 3, and real-time level 4, then real-time level 1 Tag data of real-time level 2 and real-time level 2 can be cached in update queue 1, and tag data of real-time level 3 and real-time level 4 can be cached in update queue 2.
  • the tag data can also be adjusted according to the type of tag data. The position of the data in the update queue is sorted.
  • the real-time level corresponding to the setting type may be the highest real-time level, that is, the label data of the setting type has a very high demand for real-time performance when updating.
  • the electronic device updates the tag data in the update queue, it reads each tag data in turn according to the arrangement order of the tag data in the update queue, and updates each tag data, that is, the buffer queue
  • the label data is taken out in sequence according to the arrangement order of the label data in the update queue, and the label data is updated. Therefore, for the tag data of the set type, the tag data can be updated as soon as possible. Therefore, if the type of the tag data to be updated is the set type, the tag data can also be cached in the update queue to update the update queue. Sort the label data in.
  • step S430 may include:
  • Step S431A Determine whether there is other tag data of the set type other than the tag data in the update queue.
  • Step S432A If there is no other tag data of the set type in the update queue, sort the tag data to the head of the update queue.
  • Step S433A If the other tag data exists in the update queue, sort the tag data to a position adjacent to the other tag data after the other tag data in the update queue.
  • the tag data can be inserted into the queue, that is, the tag data can be inserted to the front position.
  • it can be determined whether there is other tag data of a set type in the update queue. Since other tag data has a very high demand for real-time performance during update, and it is cached in the update queue earlier than the tag data to be updated, it is impossible to make the position of the tag data to be updated in the update queue closer to the position of other tag data. before.
  • the tag data to be updated can be queued to the top of the update queue, and when there are other tag data in the update queue, the tag data to be updated can be placed in the update queue.
  • the label data is arranged after the position of other label data and is adjacent to other label data, so that the label data to be updated is in the front position as much as possible, ensuring that the label data to be updated can be updated earlier.
  • the timeliness performance of the label data to be updated is better guaranteed.
  • step S430 may include:
  • Step S431B Determine the priority corresponding to each tag data according to the type of each tag data in the update queue.
  • Step S432B Sort the tag data with different priorities in all the tag data according to the order of the priority corresponding to each tag data.
  • Step S433B If tag data of the same priority exists in the update queue, sort the tag data of the same priority according to the sequence of the time when the tag data is cached in the update queue.
  • the tag data in the update queue when sorting the tag data in the update queue, it can also be sorted according to the priority of the tag data.
  • the type of each tag data in the update queue can be determined according to the determined type of tag data, and the priority of each tag data can be determined according to the type. And the higher the real-time level corresponding to the tag data, the higher its priority can be.
  • the type of tag data is C1
  • its corresponding real-time level is D1
  • the type of tag data is C2
  • its corresponding real-time level is D2
  • the corresponding priority of C1 type tag data is The first priority
  • the priority corresponding to the C2 type tag data is the second priority
  • the first priority is greater than the second priority.
  • the electronic device After the electronic device determines the order of priority, it can sort the tag data of different priorities in all tag data in the order of priority from high to low. And for the tag data of the same priority, the tag data of the same priority is sorted according to the sequence of the time when it is cached in the update queue. As a result, the tag data to be updated can be placed at the front position in the update queue as much as possible, so that the timeliness performance of the tag data to be updated can be better guaranteed.
  • Step S440 Update the tag data in the update queue according to the data update speed corresponding to the update queue.
  • the type of the tag data is determined, and then the tag data is cached in the update queue corresponding to the type, and the update queue is updated according to the type of the tag data in the update queue.
  • the position of the tag data is sorted, and then the tag data in the update queue is updated according to the data update speed corresponding to the update queue, so that the speed at which the obtained tag data is updated corresponds to its corresponding real-time level.
  • High-level label data can be updated quickly, ensuring the timeliness of label data.
  • the tag data to be updated is made to be at the front position in the update queue as much as possible, so that the timeliness performance of the tag data to be updated is better guaranteed.
  • the tag data updating device 400 includes: a type obtaining module 410, a data caching module 420, and a data updating module 430.
  • the type obtaining module 410 is used to obtain the type of the tag data when the tag data to be updated is obtained. Different types of tag data have different real-time levels when updating; the data caching module 420 is used to The tag data is cached in the update queue corresponding to the type, wherein different update queues correspond to different data update speeds; the data update module 430 is configured to update the update queue according to the data update speed corresponding to the update queue.
  • the tag data in is updated.
  • the type obtaining module 410 may include an identification obtaining unit 411 and a first type determining unit 412.
  • the identification acquiring unit 411 is configured to acquire the type identification in the tag data, and the type identification is used to characterize the type of tag data;
  • the first type determining unit 412 is configured to determine the type identification according to the type identification. Describe the type of label data.
  • the type obtaining module 410 may include a data source obtaining unit 413 and a second type determining unit 414.
  • the data source obtaining unit 413 is configured to obtain the data source of the tag data; the second type determining unit 414 is configured to determine the type of the tag data according to the data source.
  • the data caching module 420 may include a first caching unit and a second caching unit.
  • the first buffer unit is used for buffering the tag data to the first update queue when the type is the first type;
  • the second buffer unit is used for buffering the tag data when the type is the second type To the second update queue, wherein the real-time level corresponding to the first type of tag data is greater than the real-time level corresponding to the second type of tag data, and the data update speed corresponding to the first update queue is greater than the The data update speed corresponding to the second update queue.
  • the first caching unit may be specifically configured to: when the type is the first type, determine whether the current amount of data in the first update queue reaches the cache threshold; if the current amount of data does not reach the cache threshold, Threshold, buffer the tag data to the first update queue.
  • the first caching unit may be further configured to: if the current amount of data reaches a caching threshold, determine the caching duration of each tag data in the first update queue after it is cached in the first update queue; and obtain the For the first tag data in the first update queue, the buffer duration corresponding to the first tag data is greater than the set duration; after the first tag data is cleared from the first update queue, if the first update queue The current amount of data in the database does not reach the cache threshold, and the tag data is cached in the first update queue.
  • the first update queue and the second update queue are located in memory.
  • the first cache unit may also be used to cache the first tag data in the second update queue before the first tag data is cleared from the first update queue; or to store the first tag data in the second update queue.
  • the label data is stored on the local disk.
  • the tag data updating device 400 may further include: a tag information acquisition module, a first tag data judgment module, and a tag data clearing module.
  • the tag information obtaining module is used to obtain the user identification and tag name corresponding to the tag data
  • the first tag data judging module is used to judge whether there is second tag data in the first update queue, and the second tag data Is the tag data that is the same as the user identification and the tag name
  • the tag data clearing module is used for removing the second tag data in the first update queue if the second tag data exists in the first update queue Second, the label data is cleared.
  • the data cache module 420 may include a speed judgment unit, a utilization rate acquisition unit, and a cache execution unit.
  • the speed judgment unit is used to judge whether the data update speed corresponding to the update queue is greater than the set speed;
  • the utilization rate acquisition unit is used to obtain the remaining utilization rate of the processor if the data update speed corresponding to the update queue is greater than the set speed;
  • the cache execution unit is configured to, if the remaining utilization rate is higher than the set utilization rate, cache the tag data to the update queue corresponding to the type.
  • the cache execution unit may also be used to: if the remaining utilization rate is less than or equal to the set utilization rate, cache the tag data to the target update queue, and the data update speed corresponding to the update queue is greater than the The data update speed corresponding to the target update queue.
  • the update queue corresponds to multiple types of tag data
  • the device for updating tag data may further include a position sorting module.
  • the position sorting module is configured to: after the tag data is cached in the update queue corresponding to the type, if the type is a set type, according to the type of each tag data in the update queue To sort all the tag data.
  • the position sorting module may be specifically used to determine whether there is other tag data of the setting type other than the tag data in the update queue; if the setting does not exist in the update queue For other tag data of the type, the tag data is sorted to the head of the update queue.
  • the position sorting module may also be used to: if the other tag data exists in the update queue, sort the tag data after the other tag data in the update queue and be the same as the other tag data. The location of the neighbor.
  • the position sorting module may be specifically configured to: determine the priority corresponding to each tag data according to the type of each tag data of all tag data in the update queue; Corresponding to the high and low order of priority, the tag data of different priorities in all the tag data are sorted.
  • the position sorting module may also be used to: according to the priority order of each tag data, after sorting the tag data of different priorities in all the tag data, if there is any tag data in the update queue.
  • the tag data of the same priority is sorted according to the sequence of the time when the tag data is cached in the update queue.
  • the coupling between the modules may be electrical, mechanical or other forms of coupling.
  • each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module.
  • the above-mentioned integrated modules can be implemented in the form of hardware or software function modules.
  • the tag data is cached to the update queue corresponding to the type, and the tag data is cached in accordance with the update queue.
  • the data update speed corresponding to the queue updates the tag data in the update queue, so that tag data of different real-time levels can be entered into different update queues, and the tag data is updated according to the data update speed corresponding to the update queue. Update to ensure the real-time update of label data.
  • the electronic device 100 may be an electronic device capable of running application programs, such as a smart phone, a tablet computer, or an e-book.
  • the electronic device 100 in this application may include one or more of the following components: a processor 110, a memory 120, and one or more application programs.
  • One or more application programs may be stored in the memory 120 and configured to be Or multiple processors 110 execute, and one or more programs are configured to execute the method described in the foregoing method embodiment.
  • the processor 110 may include one or more processing cores.
  • the processor 110 uses various interfaces and lines to connect various parts of the entire electronic device 100, and executes by running or executing instructions, programs, code sets, or instruction sets stored in the memory 120, and calling data stored in the memory 120.
  • Various functions and processing data of the electronic device 100 may adopt at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA).
  • DSP Digital Signal Processing
  • FPGA Field-Programmable Gate Array
  • PDA Programmable Logic Array
  • the processor 110 may be integrated with one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), a modem, and the like.
  • the CPU mainly processes the operating system, user interface, and application programs; the GPU is used for rendering and drawing of display content; the modem is used for processing wireless communication. It can be understood that the above-mentioned modem may not be integrated into the processor 110, but may be implemented by a communication chip alone.
  • the memory 120 may include random access memory (RAM) or read-only memory (Read-Only Memory).
  • the memory 120 may be used to store instructions, programs, codes, code sets or instruction sets.
  • the memory 120 may include a program storage area and a data storage area, where the program storage area may store instructions for implementing the operating system and instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.) , Instructions used to implement the following various method embodiments, etc.
  • the data storage area can also store data (such as phone book, audio and video data, chat record data) created by the terminal 100 during use.
  • FIG. 15 shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application.
  • the computer-readable medium 800 stores program code, and the program code can be invoked by a processor to execute the method described in the foregoing method embodiment.
  • the computer-readable storage medium 800 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM.
  • the computer-readable storage medium 800 includes a non-transitory computer-readable storage medium.
  • the computer-readable storage medium 800 has storage space for the program code 810 for executing any method steps in the above-mentioned methods. These program codes can be read from or written into one or more computer program products.
  • the program code 810 may be compressed in a suitable form, for example.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A method and apparatus for updating tag data, an electronic device, and a storage medium. The method for updating tag data comprises: when tag data to be updated is obtained, acquiring the type of the tag data, wherein different types of tag data have different levels in real-time performance during updating (S110); caching the tag data to an update queue corresponding to the type, wherein different update queues correspond to different data update speeds (S120); and updating the tag data in the update queue according to a data update speed corresponding to the update queue (S130). By means of the method, real-time updating of tag data can be realized.

Description

标签数据的更新方法、装置、电子设备及存储介质Method, device, electronic equipment and storage medium for updating label data 技术领域Technical field
本申请涉及数据处理技术领域,更具体地,涉及一种标签数据的更新方法、装置、电子设备及存储介质。This application relates to the field of data processing technology, and more specifically, to a method, device, electronic device, and storage medium for updating tag data.
背景技术Background technique
随着网络信息技术的快速发展,大数据技术较为频繁的出现于日常生活中。较为典型的应用方案是信息推荐技术,信息推荐技术中通常需要根据用户标签进行推荐,用户标签在信息推荐技术中起着非常重要的作用,因此用户标签的更新是信息推荐技术中的关键。With the rapid development of network information technology, big data technology appears more frequently in daily life. A more typical application scheme is information recommendation technology. In information recommendation technology, recommendations are usually based on user tags. User tags play a very important role in information recommendation technology. Therefore, the update of user tags is the key to information recommendation technology.
发明内容Summary of the invention
鉴于上述问题,本申请提出了一种标签数据的更新方法、装置、电子设备及存储介质。In view of the above problems, this application proposes a method, device, electronic device and storage medium for updating tag data.
第一方面,本申请实施例提供了一种标签数据的更新方法,所述方法包括:当获得待更新的标签数据时,获取所述标签数据的类型,不同类型的标签数据在更新时的实时性级别不同;将所述标签数据缓存至所述类型对应的更新队列,其中,不同更新队列对应不同的数据更新速度;按照所述更新队列对应的数据更新速度,对所述更新队列中的所述标签数据进行更新。In the first aspect, an embodiment of the present application provides a method for updating label data. The method includes: when the label data to be updated is obtained, the type of the label data is obtained, and different types of label data are updated in real time. Different levels of sexuality; cache the tag data in the update queue corresponding to the type, where different update queues correspond to different data update speeds; according to the data update speed corresponding to the update queue, all data in the update queue The label data is updated.
第二方面,本申请实施例提供了一种标签数据的更新装置,所述装置包括:类型获取模块、数据缓存模块以及数据更新模块,其中,所述类型获取模块用于当获得待更新的标签数据时,获取所述标签数据的类型,不同类型的标签数据在更新时的实时性级别不同;所述数据缓存模块用于将所述标签数据缓存至所述类型对应的更新队列,其中,不同更新队列对应不同的数据更新速度;所述数据更新模块用于按照所述更新队列对应的数据更新速度,对所述更新队列中的所述标签数据进行更新。In a second aspect, an embodiment of the present application provides a device for updating tag data. The device includes: a type acquisition module, a data caching module, and a data update module. The type acquisition module is used to obtain the tag to be updated. When data is acquired, the type of the tag data is obtained. Different types of tag data have different real-time levels during update; the data caching module is used to cache the tag data to the update queue corresponding to the type, where different The update queue corresponds to different data update speeds; the data update module is used to update the tag data in the update queue according to the data update speed corresponding to the update queue.
第三方面,本申请实施例提供了一种电子设备,包括:一个或多个处理器;存储器;一个或多个应用程序,其中所述一个或多个应用程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于执行上述第一方面提供的标签数据的更新方法。In a third aspect, an embodiment of the present application provides an electronic device, including: one or more processors; a memory; one or more application programs, wherein the one or more application programs are stored in the memory and It is configured to be executed by the one or more processors, and the one or more programs are configured to execute the method for updating tag data provided in the first aspect described above.
第四方面,本申请实施例提供了一种计算机可读取存储介质,所述计算机可读取存储介质中存储有程序代码,所述程序代码可被处理器调用执行上述第一方面提供的标签数据的更新方法。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium. The computer-readable storage medium stores program code, and the program code can be called by a processor to execute the tag provided in the first aspect. How to update the data.
本申请提供的方案,通过在获得待更新的标签数据时,获取标签数据的类型,不同类型的标签数据在更新时的实时性级别不同,然后将标签数据缓存至该类型对应的更新队列,按照更新队列对应的数据更新速度,对更新队列中的标签数据进行更新,从而实现对于不同实时性级别的标签数据,能进入到不同的更新队列中,并根据更新队列对应的数据更新速度,对标签数据进行更新,保证标签数据更新的实时性。The solution provided by this application obtains the type of label data when obtaining the label data to be updated. Different types of label data have different real-time levels when updating, and then caches the label data to the update queue corresponding to the type. Update the data update speed corresponding to the update queue, update the tag data in the update queue, so as to realize that the tag data of different real-time levels can be entered into different update queues, and the tags are updated according to the data update speed corresponding to the update queue. The data is updated to ensure the real-time update of label data.
附图说明Description of the drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly describe the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings that need to be used in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
图1示出了本申请实施例提供的标签数据更新的原理示意图。Fig. 1 shows a schematic diagram of the principle of tag data update provided by an embodiment of the present application.
图2示出了根据本申请一个实施例的标签数据的更新方法流程图。Fig. 2 shows a flowchart of a method for updating tag data according to an embodiment of the present application.
图3示出了根据本申请另一个实施例的标签数据的更新方法流程图。Fig. 3 shows a flowchart of a method for updating tag data according to another embodiment of the present application.
图4示出了本申请另一个实施例提供的标签数据的更新方法中步骤S210的一种流程图。FIG. 4 shows a flowchart of step S210 in the method for updating tag data provided by another embodiment of the present application.
图5示出了本申请另一个实施例提供的标签数据的更新方法中步骤S210的另一种流程图。FIG. 5 shows another flowchart of step S210 in the method for updating tag data provided by another embodiment of the present application.
图6示出了本申请另一个实施例提供的标签数据的更新方法的原理示意图。FIG. 6 shows a schematic diagram of the principle of a method for updating tag data provided by another embodiment of the present application.
图7示出了根据本申请又一个实施例的标签数据的更新方法流程图。Fig. 7 shows a flowchart of a method for updating tag data according to another embodiment of the present application.
图8示出了根据本申请再一个实施例的标签数据的更新方法流程图。Fig. 8 shows a flowchart of a method for updating tag data according to another embodiment of the present application.
图9示出了本申请提供的再一个实施例的标签数据的更新方法中步骤S430的一种流程图。FIG. 9 shows a flowchart of step S430 in the method for updating tag data according to another embodiment provided by the present application.
图10示出了本申请提供的再一个实施例的标签数据的更新方法中步骤S430的另一种流程图。FIG. 10 shows another flow chart of step S430 in the method for updating tag data in another embodiment provided by the present application.
图11示出了根据本申请一个实施例的标签数据的更新装置的一种框图。Fig. 11 shows a block diagram of a device for updating tag data according to an embodiment of the present application.
图12示出了根据本申请一个实施例的标签数据的更新装置中类型获取模块的一种框图。Fig. 12 shows a block diagram of the type acquisition module in the device for updating tag data according to an embodiment of the present application.
图13示出了根据本申请一个实施例的标签数据的更新装置中类型获取模块的另一种框图。Fig. 13 shows another block diagram of the type acquisition module in the device for updating tag data according to an embodiment of the present application.
图14是本申请实施例的用于执行根据本申请实施例的标签数据的更新方法的电子设备的框图。FIG. 14 is a block diagram of an electronic device for executing the method for updating tag data according to an embodiment of the present application according to an embodiment of the present application.
图15是本申请实施例的用于保存或者携带实现根据本申请实施例的标签数据的更新方法的程序代码的存储单元。Fig. 15 is a storage unit for storing or carrying program code implementing the method for updating tag data according to the embodiment of the present application according to an embodiment of the present application.
具体实施方式Detailed ways
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。In order to enable those skilled in the art to better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the accompanying drawings in the embodiments of the present application.
随着信息技术的快速发展,互联网给人们的生活和工作带来了越来越多的便利。其中,基于大数据技术的信息推荐技术能推荐人们需求的内容,可以较好的满足用的需求。例如,人们可以通过互联网进行购物、娱乐以及发布个人状态信息(例如,发微博)等,商家通过互联网可获取到人们的消费、娱乐以及个人状态信息等内容,可以更为全面的了解大众的需求,进而根据大众的需求为人们提供推荐服务。在商家为人们提供推荐服务的同时,商家也得到了盈利。With the rapid development of information technology, the Internet has brought more and more convenience to people's lives and work. Among them, information recommendation technology based on big data technology can recommend content that people need, which can better meet the needs of users. For example, people can use the Internet to shop, entertain, and publish personal status information (for example, Weibo), etc. Merchants can obtain people’s consumption, entertainment, and personal status information through the Internet, which can provide a more comprehensive understanding of the public’s information. Demand, and then provide recommendations for people based on the needs of the public. While businesses provide people with recommendation services, businesses also make profits.
在信息推荐的技术中,其主要应用了用户标签,使推荐内容能满足用户的需求。用户标签主要为用于反映用户的社会属性、生活习惯和消费行为等信息的数据,用户标签为通过对用户信息进行分析而得到的特征标识。用户标签通过不断进行更新标签数据,从而使用户标签能保证精准性。In the information recommendation technology, it mainly applies user tags, so that the recommended content can meet the needs of users. User tags are mainly data used to reflect information such as users' social attributes, living habits, and consumption behaviors, and user tags are feature identifiers obtained by analyzing user information. The user tag continuously updates the tag data, so that the user tag can ensure accuracy.
在传统的技术中,标签数据主要存储在数据库中,对用户标签进行管理的电子设备通常收集来自不同数据源的标签数据,并将标签数据写入到标签数据库中。数据源可以为服务器、移动终端等,在此不做限定。In traditional technology, tag data is mainly stored in a database, and electronic devices that manage user tags usually collect tag data from different data sources and write the tag data into the tag database. The data source can be a server, a mobile terminal, etc., which is not limited here.
传统技术中的标签数据的更新,通常把所有标签数据进行统一处理,在标签数据到来时,进行数据的离线化处理,等待数据全部离线计算完成后,再统一向标签管理系统发起存储或更新请求,这样对于大量数据进行更新时,能高效的进行聚合处理,减小对标签管理系统的压力。The tag data update in the traditional technology usually processes all tag data in a unified manner. When tag data arrives, the data is offline processed, and after all the data is offline calculated, the storage or update request is uniformly initiated to the tag management system. In this way, when a large amount of data is updated, it can efficiently perform aggregation processing and reduce the pressure on the label management system.
发明人经过长期研究发现,传统技术中对标签数据的更新方案,不能满足更新比较频繁的标签数据的更新。例如,地理位置按照传统的方案进行更新,因为离线的时 间较长,会存在用户实际已经移动到另一个地方,而实际写入标签数据库的为此前的地理位置,如果再利用此前的地理位置进行处理,则不利于业务的使用。例如,如图1所示,地理位置数和其他数据被(数据A、数据B)获取到时,会一起进行聚合操作,进入到同一缓冲队列701中,然后统一由标签更新程序702更新到标签存储系统703中,但整个过程需要花费较多时间,对于实时性要求比较高的数据,容易失去时效性。After long-term research, the inventor found that the update scheme for tag data in the traditional technology cannot satisfy the update of tag data that is updated frequently. For example, the geographical location is updated according to the traditional scheme. Because the offline time is long, there will be users who have actually moved to another place, and the previous geographical location is actually written into the tag database. If the previous geographical location is used again Treatment is not conducive to the use of business. For example, as shown in Figure 1, when the number of geographic locations and other data are obtained (data A, data B), they will be aggregated together, enter the same buffer queue 701, and then be updated to the label by the label update program 702. In the storage system 703, the entire process takes a lot of time, and data with high real-time requirements is likely to lose timeliness.
针对上述问题,发明人提出了本申请实施例提供的标签数据的更新方法、装置、电子设备以及存储介质,通过在获取到待更新的标签数据时,根据标签数据的类型,将标签数据缓存至其类型对应的更新队列,并根据更新队列对应的数据更新速度,对标签数据进行更新,保证标签数据更新的实时性。其中,具体的标签数据的更新方法在后续的实施例中进行详细的说明。In response to the above problems, the inventors proposed the method, device, electronic device and storage medium for updating tag data provided by the embodiments of the present application. When the tag data to be updated is obtained, the tag data is cached according to the type of the tag data. The update queue corresponds to its type, and the tag data is updated according to the data update speed corresponding to the update queue to ensure the real-time update of the tag data. Among them, the specific method for updating the tag data will be described in detail in the subsequent embodiments.
请参阅图2,图2示出了本申请一个实施例提供的标签数据的更新方法的流程示意图。所述标签数据的更新方法用于实现对于不同实时性级别的标签数据,能进入到不同的更新队列中,并根据更新队列对应的数据更新速度,对标签数据进行更新,保证标签数据更新的实时性。在具体的实施例中,所述标签数据的更新方法应用于如图11所示的标签数据的更新装置400以及配置有所述标签数据的更新装置400的电子设备100(图14)。下面将以电子设备为例,说明本实施例的具体流程,当然,可以理解的,本实施例所应用的电子设备可以为服务器、移动终端等,在此不做限定。下面将针对图2所示的流程进行详细的阐述,所述标签数据的更新方法具体可以包括以下步骤:Please refer to FIG. 2, which shows a schematic flowchart of a method for updating tag data provided by an embodiment of the present application. The tag data update method is used to realize that tag data of different real-time levels can be entered into different update queues, and the tag data is updated according to the data update speed corresponding to the update queue to ensure the real-time update of tag data Sex. In a specific embodiment, the tag data updating method is applied to the tag data updating device 400 as shown in FIG. 11 and the electronic device 100 configured with the tag data updating device 400 (FIG. 14 ). The following will take an electronic device as an example to describe the specific process of this embodiment. Of course, it is understandable that the electronic device applied in this embodiment may be a server, a mobile terminal, etc., which is not limited herein. The process shown in FIG. 2 will be described in detail below, and the method for updating label data may specifically include the following steps:
步骤S110:当获得待更新的标签数据时,获取所述标签数据的类型,不同类型的标签数据在更新时的实时性级别不同。Step S110: When the tag data to be updated is obtained, the type of the tag data is obtained, and different types of tag data have different real-time levels when being updated.
在本申请实施例中,电子设备可以对用户的标签数据进行管理,电子设备管理的标签数据可以来源于数据源。其中,数据源可以为服务器,也可以为移动终端等,在此不做限定。电子设备可以从数据源获取标签数据,以对用户的标签数据进行更新。标签数据指标签对应的数据,具体可以为标签对应的用户数据。例如,用户A在第一时刻的职业为学生,在第二时刻的职业为教师,则在第一时刻,用户A的标签中职业对应的数据则为学生,在第二时刻,用户A的标签中职业对应的数据为教师。由于用户的标签数据随着时间推移是在发生变化的,因此需要对用户的标签数据不断进行更新,以使用户的标签数据能与用户最新的状态匹配,从而能根据标签数据为用户提供满足需求的服务。In the embodiment of the present application, the electronic device can manage the user's tag data, and the tag data managed by the electronic device can come from a data source. Among them, the data source may be a server, or a mobile terminal, etc., which is not limited here. The electronic device can obtain the label data from the data source to update the user's label data. The label data refers to data corresponding to the label, and specifically may be user data corresponding to the label. For example, the occupation of user A at the first moment is a student, and the occupation at the second moment is a teacher. At the first moment, the data corresponding to the occupation in the label of user A is student. At the second moment, the label of user A The data corresponding to the middle occupation is teachers. Since the user’s label data is changing over time, it is necessary to continuously update the user’s label data so that the user’s label data can match the user’s latest status, so as to provide users with the ability to meet their needs based on the label data. Service.
在一些实施方式中,电子设备可以主动从数据源获取待更新的标签数据,也可以接收数据源发送的待更新标签数据。待更新的标签数据指获得的需要写入到标签数据的数据库中的标签数据,也可以理解为用于对用户标签进行更新的标签数据。In some embodiments, the electronic device may actively obtain the tag data to be updated from the data source, or may receive the tag data to be updated sent by the data source. The label data to be updated refers to the obtained label data that needs to be written into the label data database, and can also be understood as the label data used to update the user label.
在一些实施方式中,电子设备可以定时或者不定时的从数据源获取待更新的标签数据。例如,电子设备可以按照预设间隔从数据源获取待更新的标签数据,又例如,电子设备可以实时的从数据源接收待更新的标签数据。In some embodiments, the electronic device may obtain the tag data to be updated from the data source regularly or irregularly. For example, the electronic device may obtain the tag data to be updated from the data source at a preset interval. For another example, the electronic device may receive the tag data to be updated from the data source in real time.
在本申请实施例中,电子设备在获得到待更新的标签数据时,可以确定待更新的标签数据的类型。不同类型的标签数据在更新时的实时性级别不同,其中,标签数据在更新时的实时性级别,可以指标签数据在更新时对于实时性的需求级别,实时性级别越高,则该标签数据则越需要实时的更新。例如,标签数据的类型包括类型A、类型B以及类型C,则类型A、类型B以及类型C的标签数据对应的实时性级别互不相同,类型A的标签数据对应的实时性级别可以大于类型B的标签数据对应的实时性级别,类型B的标签数据对应的实时性级别可以大于类型C的标签数据对应的实时性级别,当然,以上仅为举例,并不代表对具体的类型与实时性级别的关系的限定。In the embodiment of the present application, when the electronic device obtains the tag data to be updated, it can determine the type of the tag data to be updated. Different types of label data have different real-time levels when they are updated. Among them, the real-time level of label data when it is updated can refer to the level of real-time demand for label data when it is updated. The higher the real-time level, the higher the real-time level of the label data. The more real-time updates are needed. For example, the types of tag data include type A, type B, and type C. The tag data of type A, type B, and type C have different real-time levels. The tag data of type A can have a higher real-time level than type C. The real-time level corresponding to the label data of B, the real-time level corresponding to the label data of type B can be greater than the real-time level corresponding to the label data of type C. Of course, the above is only an example, and does not represent the specific type and real-time Limitation of the level of relationship.
在一些实施方式中,标签数据的类型,可以为预先根据标签数据对应的实时性级别的不同,对不同的标签数据进行分类后的分类结果,每个分类结果可以对应一个类型,属于同一类型的标签数据对应的实时性级别可以相同。例如,用户的定位位置、 用户的网页浏览信息等对于更新时的实时性需求非常强,其实时性级别处于第一级别,则定位位置、网页浏览信息等可以作为一个类型;用户的用餐、消费金额等对于更新时的实时性需求较强,其实时性级别处于第二级别,则于用户的用餐、消费金额等可以作为一个类型;用户的职业、年龄等对于更新时的实时性需求不强,其实时性级别处于第三级别,则于用户的职业、年龄等可以作为一个类型,其中第一级别、第二级别以及第三级别之间的高低顺序为依次降低的顺序,当然,以上仅为举例,并不代表对具体的类型的限定。In some embodiments, the type of label data may be the classification result of different label data classified in advance according to the real-time level corresponding to the label data. Each classification result may correspond to a type and belong to the same type. The real-time level corresponding to the tag data can be the same. For example, the user’s location, the user’s web browsing information, etc. have very strong real-time requirements for updating, and its real-time level is at the first level, then the location, web browsing information, etc. can be used as a type; the user’s dining and consumption Amount, etc., have a strong demand for real-time during update, and its real-time level is at the second level, so the user’s meal, consumption amount, etc. can be used as a type; the user’s occupation, age, etc. do not have a strong demand for real-time during update , Its real-time level is at the third level, the user’s occupation, age, etc. can be used as a type, where the first level, the second level, and the third level are in descending order. Of course, the above is only For example, it does not represent a limitation on specific types.
在一些实施方式中,标签数据的类型可以预先存储于电子设备,电子设备可以通过识别标签数据中的字段数据、来源的数据源、用户标识等,确定标签数据的类型,在此不做限定。In some embodiments, the type of tag data can be pre-stored in the electronic device, and the electronic device can determine the type of tag data by identifying the field data in the tag data, the data source of the source, the user identification, etc., which is not limited here.
步骤S120:将所述标签数据缓存至所述类型对应的更新队列,其中,不同更新队列对应不同的数据更新速度。Step S120: Buffer the tag data in the update queue corresponding to the type, where different update queues correspond to different data update speeds.
在本申请实施例中,电子设备的内存中可以预先创建有多个更新队列,该更新队列用于缓存待更新的标签数据。并且,每个更新队列对应一个标签数据的类型,每个更新队列对应的数据更新速度不同,更新队列的个数与类型数量相同,更新队列的具体个数可以不作为限定。例如,标签数据对应的类型包括第一类型、第二类型以及第三类型,则电子设备中可以预先创建有三个更新队列,三个更新队列分别与第一类型、第二类型以及第三类型对应。更新队列对应的数据更新速度,可以指后续从更新队列中取出标签数据并进行更新的过程中的速度。In the embodiment of the present application, a plurality of update queues may be pre-created in the memory of the electronic device, and the update queues are used to cache tag data to be updated. In addition, each update queue corresponds to a type of tag data, the data update speed corresponding to each update queue is different, the number of update queues is the same as the number of types, and the specific number of update queues is not limited. For example, if the types corresponding to the tag data include the first type, the second type, and the third type, three update queues can be created in advance in the electronic device, and the three update queues correspond to the first type, the second type, and the third type, respectively. . The data update speed corresponding to the update queue may refer to the speed in the subsequent process of taking out the tag data from the update queue and updating it.
在一些实施方式中,由于不同的更新队列对应不同的标签数据的类型,并且不同类型的标签数据在更新时的实时性级别不同,因此更新队列对应的数据更新速度可以与其对应的类型的标签数据在更新时的实时性级别对应,从而使得更新队列可以满足与其对应的类型的标签数据在更新时的实时性需求。具体的,更新队列对应的类型的标签数据的实时性级别越高,则更新队列对应的数据更新速度越快,从而能保证实时性级别高的标签数据能快速的被更新,保证标签数据的时效性。In some embodiments, because different update queues correspond to different types of tag data, and different types of tag data have different real-time levels when they are updated, the data update speed corresponding to the update queue may correspond to the corresponding type of tag data. The real-time level during the update corresponds to, so that the update queue can meet the real-time requirements of the corresponding type of tag data during the update. Specifically, the higher the real-time level of the tag data corresponding to the update queue, the faster the data update speed corresponding to the update queue, thereby ensuring that the tag data with high real-time level can be updated quickly and ensuring the timeliness of the tag data Sex.
在本申请实施例中,电子设备在确定出待更新的标签数据对应的类型之后,则可以根据标签数据对应的类型,从预先创建的多个更新队列中,确定与该类型对应的更新队列。电子设备确定出的该类型对应的更新队列,用于缓存获得的标签数据,电子设备可以将步骤S110中获得的标签数据缓存至该类型对应的更新队列中,以便后续对获得的标签数据进行更新。In the embodiment of the present application, after the electronic device determines the type corresponding to the tag data to be updated, it can determine the update queue corresponding to the type from a plurality of pre-created update queues according to the type corresponding to the tag data. The update queue corresponding to this type determined by the electronic device is used to cache the obtained tag data. The electronic device may cache the tag data obtained in step S110 in the update queue corresponding to this type, so as to subsequently update the obtained tag data .
在一些实施方式中,可以根据从更新队列中取标签数据的速度,以及将标签数据更新到标签数据库中的速度,来控制不同更新队列对应的数据更新速度。当然,具体实现不同更新队列对应不同更新速度的方式,可以不作为限定。In some embodiments, the data update speed corresponding to different update queues can be controlled according to the speed of fetching tag data from the update queue and the speed of updating the tag data to the tag database. Of course, the specific implementation of different update queues corresponding to different update speeds may not be regarded as a limitation.
步骤S130:按照所述更新队列对应的数据更新速度,对所述更新队列中的所述标签数据进行更新。Step S130: Update the tag data in the update queue according to the data update speed corresponding to the update queue.
在本申请实施例中,在将获得的标签数据缓存至相应的更新队列后,则可以按照该更新队列对应的数据更新速度,对更新队列中的标签数据进行更新,使获得的标签数据被更新的速度,与其对应的实时性级别对应。并且由于更新队列对应的类型的标签数据的实时性级别越高,则更新队列对应的数据更新速度越快,从而对于实时性级别高标签数据,可以快速的被更新,保障了标签数据的时效性。另外,由于保证数据更新速度较高会占用电子设备较多的资源,因此电子设备中并非所有更新队列的更新速度都对应较高的数据更新速度,对于实时性级别低的标签数据,则会进入到数据更新速度相对较慢的更新队列,而不是所有标签数据都进入数据更新速度相对较快的更新队列中,使得电子设备的资源不会被标签数据的更新任务占用过多的资源,有效的利用了电子设备的资源。In the embodiment of the present application, after the obtained tag data is cached in the corresponding update queue, the tag data in the update queue can be updated according to the data update speed corresponding to the update queue, so that the obtained tag data is updated The speed corresponds to its corresponding real-time level. And because the higher the real-time level of the tag data corresponding to the update queue, the faster the data update speed corresponding to the update queue, so that the tag data with high real-time level can be updated quickly, ensuring the timeliness of the tag data . In addition, since ensuring that the data update speed is high will occupy more resources of the electronic device, not all the update speeds of the update queues in the electronic device correspond to the higher data update speed. For the label data with low real-time level, it will enter To the update queue with a relatively slow data update speed, instead of all tag data entering the update queue with a relatively fast data update speed, the resources of the electronic device will not be occupied by too many resources by the update task of the tag data, which is effective Utilizes the resources of electronic equipment.
本申请实施例提供的标签数据的更新方法,通过在获得待更新的标签数据时,确 定标签数据的类型,然后将标签数据缓存至该类型对应的更新队列中,再按照该更新队列对应的数据更新速度,对更新队列中的标签数据进行更新,使得获得的标签数据被更新的速度,与其对应的实时性级别对应,从而对于实时性级别高的标签数据,可以快速的被更新,保障了标签数据的时效性。The method for updating tag data provided in the embodiments of the present application determines the type of tag data when obtaining tag data to be updated, then caches the tag data in the update queue corresponding to the type, and then according to the data corresponding to the update queue Update speed, update the label data in the update queue, so that the speed at which the obtained label data is updated corresponds to the corresponding real-time level, so that the label data with high real-time level can be updated quickly, ensuring the label Timeliness of data.
请参阅图3,图3示出了本申请另一个实施例提供的标签数据的更新方法的流程示意图。该方法应用于上述电子设备,下面将针对图3所示的流程进行详细的阐述,所述标签数据的更新方法具体可以包括以下步骤:Please refer to FIG. 3, which shows a schematic flowchart of a method for updating tag data provided by another embodiment of the present application. This method is applied to the above-mentioned electronic equipment. The process shown in FIG. 3 will be described in detail below. The method for updating label data may specifically include the following steps:
步骤S210:当获得待更新的标签数据时,获取所述标签数据的类型,不同类型的标签数据在更新时的实时性级别不同。Step S210: When the tag data to be updated is obtained, the type of the tag data is obtained, and different types of tag data have different real-time levels when being updated.
在本申请实施例中,标签数据的类型可以与标签数据的类型标识对应,也可以与标签数据的数据源对应。电子设备在获取标签数据的类型时,可以根据标签数据的类型标识或者标签数据对应的数据源确定。In the embodiment of the present application, the type of the tag data may correspond to the type identification of the tag data, or it may correspond to the data source of the tag data. When the electronic device obtains the type of tag data, it can be determined according to the type identification of the tag data or the data source corresponding to the tag data.
在一种实例中,每个标签数据中可以包括一个三段式的身份标识,该三段式的身份标识由标识a、标识b及标识c构成,标识a可以用于表示标签数据所属的大类(例如大类包括个人类型和家人类型),标识b用于表示与实时性级别对应的类型,通过标识b即可确定与实时性级别对应的类型,标识c可以用于表示标签名称。例如,标签数据的类型分为第一类型以及第二类型,b1可以表示第一类型,b2可以表示第二类型。当然,以上仅为举例,并不代表对实际类型标识的限定。In an example, each tag data may include a three-segment identification, the three-segment identification is composed of an identification a, an identification b, and an identification c, and the identification a may be used to indicate the large Category (for example, category includes personal type and family type), the identifier b is used to indicate the type corresponding to the real-time level, the type corresponding to the real-time level can be determined by the identifier b, and the identifier c can be used to indicate the label name. For example, the types of tag data are divided into a first type and a second type, b1 can represent the first type, and b2 can represent the second type. Of course, the above is only an example, and does not represent a limitation on the actual type identification.
在一些实施方式中,请参阅图4,步骤S210可以包括:In some embodiments, referring to FIG. 4, step S210 may include:
步骤S211A:获取所述标签数据中的类型标识,所述类型标识用于表征标签数据的类型;Step S211A: Obtain a type identifier in the tag data, where the type identifier is used to characterize the type of tag data;
步骤S212A:根据所述类型标识,确定所述标签数据的类型。Step S212A: Determine the type of the tag data according to the type identification.
可以理解的,标签数据中可以包括类型标识。类型标识处于标签数据的设定字段,电子设备可以通过获取标签数据中设定字段的数据,从而获得标签数据的类型标识,电子设备在获取到标签数据的类型标识后,则可以根据类型标识,确定标签数据的类型。It is understandable that the tag data may include a type identification. The type identification is in the setting field of the label data. The electronic device can obtain the type identification of the label data by obtaining the data of the setting field in the label data. After the electronic device obtains the type identification of the label data, it can identify according to the type, Determine the type of label data.
在另一些实施方式中,请参阅图5,步骤S210可以包括:In other embodiments, referring to FIG. 5, step S210 may include:
步骤S211B:获取所述标签数据的数据源;Step S211B: Obtain the data source of the tag data;
步骤S212B:根据所述数据源,确定所述标签数据的类型。Step S212B: Determine the type of the tag data according to the data source.
在一些实施方式中,不同数据源的标签数据在更新时的实时性级别可以不同,数据源的标签数据在更新时的实时性级别,可以指该数据源的标签数据在更新时对于实时性的需求级别,实时性级别越高,则该数据源的标签数据则越需要实时的更新。另外,对标签数据的类型进行划分,是以标签数据在更新时的实时性级别确定的,因此可以根据标签数据的数据源,确定标签数据的类型。In some embodiments, the label data of different data sources may have different real-time levels when they are updated. The real-time level of the label data of the data source when it is updated can refer to the real-time performance of the label data of the data source when it is updated. The demand level, the higher the real-time level, the more the label data of the data source needs to be updated in real time. In addition, the type of tag data is classified based on the real-time level of tag data when it is updated. Therefore, the type of tag data can be determined according to the data source of the tag data.
作为一种具体的实施方式,不同数据源的标识与类型的对应关系可以预先存储于电子设备,电子设备可以通过识别数据源的标识等,确定数据源后,根据该对应关系,以及数据源的标识,确定标签数据的类型。As a specific implementation, the corresponding relationship between the identities and types of different data sources can be stored in the electronic device in advance. The electronic device can identify the identity of the data source, etc., after determining the data source, according to the corresponding relationship and the data source’s corresponding relationship. Identification, which determines the type of label data.
在一些实施方式中,标签数据的类型可以分为第一类型以及第二类型,第一类型的标签数据对应的实时性级别可以高于第二类型的标签数据对应的实时性级别。其中,第一类型的标签数据可以为对于标签数据的更新时的实时性需求较高的标签数据,即时效性较强的标签数据,如果不实时更新该类型的标签数据,则会导致该第一类型的标签数据失去其作用。例如,第一类型的标签数据可以为位置数据、网页浏览信息、消费记录、网页浏览记录等时效性强的数据,第二类型的标签数据可以为用户年龄、用户职业、用户性别等时效性不强的数据。In some embodiments, the types of tag data can be divided into a first type and a second type, and the real-time level corresponding to the first type of tag data may be higher than the real-time level corresponding to the second type of tag data. Among them, the first type of label data can be label data that requires high real-time performance when updating label data, and label data with strong immediate effect. If the label data of this type is not updated in real time, it will cause the first label data to be updated. One type of label data loses its function. For example, the first type of label data can be location data, web browsing information, consumption records, web browsing records and other time-sensitive data, and the second type of label data can be user age, user occupation, user gender and other time-sensitive data. Strong data.
步骤S220:当所述类型为第一类型时,将所述标签数据缓存至第一更新队列。Step S220: When the type is the first type, buffer the tag data in the first update queue.
在一些实施方式中,第一类型可以对应第一更新队列,第二类型可以对应第二更 新队列,并且第一更新队列对应的数据更新速度所述第二更新队列对应的数据更新速度。因此,如果获得的标签数据为第一类型,则可以将标签数据缓存至第一更新队列;如果获得的标签数据为第二类型,则可以将标签数据缓存至第二更新队列。In some embodiments, the first type may correspond to the first update queue, the second type may correspond to the second update queue, and the data update rate corresponding to the first update queue is the data update rate corresponding to the second update queue. Therefore, if the obtained tag data is of the first type, the tag data can be cached in the first update queue; if the obtained tag data is of the second type, the tag data can be cached in the second update queue.
在一些实施方式中,第一更新队列对应的数据更新速度可以大于设定速度,使每个第一类型的标签数据在更新时花费的时间较少,从而实现对第一类型的标签数据的实时更新。设定速度的具体数值可以不做限定,例如设定速度可以为2条/分钟,即每分钟更新两条标签数据,或者每条标签数据更新时花费的时间为30秒。In some embodiments, the data update speed corresponding to the first update queue may be greater than the set speed, so that each tag data of the first type takes less time to update, thereby realizing the real-time data of the first type tag. Update. The specific value of the setting speed may not be limited. For example, the setting speed may be 2 pieces/minute, that is, two pieces of label data are updated every minute, or the time it takes to update each piece of label data is 30 seconds.
在一些实施方式中,步骤S220可以包括:当所述类型为第一类型时,判断所述第一更新队列中的当前数据量是否达到缓存阈值;如果所述当前数据量未达到缓存阈值,将所述标签数据缓存至第一更新队列。In some embodiments, step S220 may include: when the type is the first type, determining whether the current amount of data in the first update queue reaches a cache threshold; if the current amount of data does not reach the cache threshold, The tag data is cached in the first update queue.
其中,为第一更新队列中的标签数据能被实时更新,第一更新队列的吞吐量(即可缓存的数据量)较小,并且其中的标签数据将很快被更新,适合处理小批量的标签数据。也就是说,如果第一更新队列可缓存的数据量较大,且第一更新队列中缓存的数据量达到缓存阈值的情况下,处于更新队列中末尾的标签数据将很长时间后才能被更新,而不能被实时更新,失去其时效性,因此第一更新队列可缓存的数据量不会太大,从而保证第一更新队列中标签数据较多的情况下,处于队列中末尾的标签数据依然能被实时更新。相反的,第二更新队列适合大批量的标签数据,具有较高吞吐量,对标签数据更新花费的时间较长。Among them, because the tag data in the first update queue can be updated in real time, the throughput of the first update queue (that is, the amount of cached data) is small, and the tag data in it will be updated quickly, which is suitable for processing small batches. Label data. In other words, if the amount of data that can be cached in the first update queue is large and the amount of data cached in the first update queue reaches the cache threshold, the tag data at the end of the update queue will not be updated until a long time. , It cannot be updated in real time and loses its timeliness. Therefore, the amount of data that can be cached in the first update queue will not be too large, so as to ensure that the tag data at the end of the queue remains the same when there are more tag data in the first update queue. Can be updated in real time. On the contrary, the second update queue is suitable for large batches of tag data, has a higher throughput, and takes longer to update the tag data.
因此,标签数据的类型为第一类型时,在将标签数据缓存至第一更新队列中之前,可以确定第一更新队列中的当前数据量是否达到缓存阈值。其中,第一更新队列中的当前数据量指的是当前第一更新队列中已缓存的标签数据的数据量;缓存阈值可以指第一更新队列可容纳的数据量大小,也可以为小于第一更新队列可容纳的数据量大小的数值,在此不做限定。在确定第一更新队列中的当前数据量是否达到缓存阈值之后,如果当前数据量未达到缓存阈值的情况下,则可以将标签数据缓存至第一更新队列中。而如果当前数据量达到缓存阈值的情况下,表示第一更新队列中已不能容纳其他标签数据,因此不能直接将标签数据缓存至第一更新队列。Therefore, when the type of tag data is the first type, before the tag data is cached in the first update queue, it can be determined whether the current amount of data in the first update queue reaches the cache threshold. Among them, the current data volume in the first update queue refers to the current data volume of the tag data that has been cached in the first update queue; the cache threshold can refer to the data volume that the first update queue can hold, or it can be smaller than the first update queue. The value of the amount of data that the update queue can hold is not limited here. After determining whether the current data volume in the first update queue reaches the cache threshold, if the current data volume does not reach the cache threshold, the tag data may be cached in the first update queue. However, if the current data volume reaches the cache threshold, it means that other tag data cannot be accommodated in the first update queue, and therefore the tag data cannot be directly cached to the first update queue.
进一步的,该标签数据的更新方法还可以包括:如果所述当前数据量达到缓存阈值,确定所述第一更新队列中每个标签数据缓存至所述第一更新队列后的缓存时长;获取所述第一更新队列中的第一标签数据,所述第一标签数据对应的缓存时长大于设定时长;从所述第一更新队列中清除所述第一标签数据后,如果所述第一更新队列中的当前数据量未达到所述缓存阈值,将所述标签数据缓存至所述第一更新队列。Further, the method for updating tag data may further include: if the current data volume reaches a cache threshold, determining the cache duration of each tag data in the first update queue after being cached in the first update queue; For the first tag data in the first update queue, the buffer duration corresponding to the first tag data is greater than the set duration; after the first tag data is cleared from the first update queue, if the first update The current amount of data in the queue does not reach the cache threshold, and the tag data is cached in the first update queue.
在该方式下,在当前数据量达到缓存阈值的情况时,表示第一更新队列中已不能容纳其他标签数据,此时可以从第一更新队列中确定缓存时长大于设定时长的标签数据,作为第一标签数据。其中,第一标签数据的缓存时长大于设定时长,则表示可能由于当前的设备因素,导致更新速度较慢,使第一标签数据已经缓存较久而未被更新,失去了时效性。因此,可以将第一标签数据从第一更新队列中清除,而将待更新的标签数据缓存至第一更新队列,使待更新的标签数据可以被更新。In this way, when the current data volume reaches the cache threshold, it means that other tag data cannot be accommodated in the first update queue. At this time, the tag data whose cache duration is greater than the set duration can be determined from the first update queue as The first label data. Wherein, the cache duration of the first tag data is greater than the set duration, which means that the update speed may be slow due to current device factors, so that the first tag data has been cached for a long time without being updated, and the timeliness is lost. Therefore, the first tag data can be cleared from the first update queue, and the tag data to be updated can be cached in the first update queue, so that the tag data to be updated can be updated.
进一步的,第一更新队列以及第二更新队列位于内存中。在所述从所述第一更新队列中清除所述第一标签数据之前,该标签数据的更新方法还可以包括:将所述第一标签数据缓存至所述第二更新队列;或者将所述第一标签数据存储至本地磁盘。可以理解的,由于第一标签数据已经不能实时的更新,但为了不使第一标签数据丢失,仍然可以将第一标签数据进行保存,具体则可以是将第一标签数据缓存至第二更新队列,使第一标签数据后续可以更新至标签数据库,或者将第一标签数据存储至本地磁盘,而实现数据的保留。Further, the first update queue and the second update queue are located in memory. Before the clearing of the first tag data from the first update queue, the method for updating the tag data may further include: buffering the first tag data in the second update queue; or storing the first tag data in the second update queue; The first label data is stored to the local disk. It is understandable that since the first tag data cannot be updated in real time, but in order not to lose the first tag data, the first tag data can still be saved. Specifically, the first tag data can be cached in the second update queue. , So that the first tag data can be subsequently updated to the tag database, or the first tag data can be stored in a local disk, so as to achieve data retention.
在一些实施方式中,在当前数据量达到缓存阈值的情况时,如果第一更新队列中不存在上述第一标签数据,则可以将待更新的标签数据暂时缓存到本地磁盘或者缓存 到内存中的缓冲队列,在第一更新队列中的当前数据量低于缓存阈值时,再将待更新的标签数据取出之后,缓存至第一更新队列,使第一更新队列仍可以较快的被更新。In some embodiments, when the current data volume reaches the cache threshold, if the first tag data does not exist in the first update queue, the tag data to be updated can be temporarily cached to the local disk or cached in the memory. In the buffer queue, when the current data volume in the first update queue is lower than the buffer threshold, the tag data to be updated is retrieved and cached in the first update queue, so that the first update queue can still be updated relatively quickly.
在一些实施方式中,该标签数据的更新方法还可以包括:获取所述标签数据对应的用户标识以及标签名称;判断所述第一更新队列中是否存在第二标签数据,所述第二标签数据为所述用户标识对应的所述标签名称的标签数据;如果所述第一更新队列中存在所述第二标签数据,将所述第一更新队列中的所述第二标签数据清除。In some embodiments, the method for updating tag data may further include: obtaining a user ID and tag name corresponding to the tag data; determining whether there is second tag data in the first update queue, and the second tag data Identify the tag data of the tag name corresponding to the user; if the second tag data exists in the first update queue, clear the second tag data in the first update queue.
可以理解的,在将待更新的标签数据缓存至第一更新队列之前,还可以确定第一更新队列中与待更新的标签数据属于同一用户,且标签名称相同的标签数据,因此可以获取待更新的标签数据对应的用户标识以及标签名称,并判断第一更新队列中是否存在与该用户标识以及该标签名称相同的标签数据(第二标签数据),如果存在第二标签数据,则可以将其清除,从而后续将最新的相同名称的标签数据,更新至该用户的标签数据中,以避免将已非最新的第二标签数据进行更新,而占据更新时长,提升了标签更新的速度。例如,待更新的标签数据为用户标识为M1的当前位置数据,第一更新队列中存在用户标识为M1的当前位置数据,对于第一更新队列中的当前位置数据而言,已经不是用户标识为M1的用户的最新的当前位置数据,失去了其作为用户的当前位置数据的作用,因此可以将第一更新队列中已存在的用户标识为M1的当前位置数据进行清除,提升标签更新的速度。It is understandable that before the tag data to be updated is cached in the first update queue, it can also be determined that the tag data in the first update queue and the tag data to be updated belong to the same user and have the same tag name. Therefore, the tag data to be updated can be obtained. Tag data corresponding to the user ID and tag name, and determine whether there is tag data (second tag data) that is the same as the user ID and tag name in the first update queue. If there is second tag data, it can be Clear, so as to subsequently update the latest label data with the same name to the label data of the user, so as to avoid updating the second label data that is not up to date and occupy the update time, which improves the speed of label update. For example, the tag data to be updated is the current location data with the user identification as M1, the current location data with the user identification as M1 exists in the first update queue, and the current location data in the first update queue is no longer the user identification as The latest current location data of the user of M1 loses its role as the current location data of the user. Therefore, the current location data of the user identified as M1 in the first update queue can be cleared to improve the tag update speed.
步骤S230:当所述类型为第二类型时,将所述标签数据缓存至第二更新队列。Step S230: When the type is the second type, buffer the tag data to the second update queue.
在本申请实施例中,待更新的标签数据的类型为第二类型时,由于第二类型的标签数据对于更新时的实时性需求不高,因此可以将标签数据缓存至第二更新队列中,而不会影响到标签数据实际的作用。In the embodiment of the present application, when the type of the tag data to be updated is the second type, since the second type of tag data does not have a high demand for real-time performance during update, the tag data can be cached in the second update queue. It will not affect the actual function of the label data.
步骤S240:按照所述更新队列对应的数据更新速度,对所述更新队列中的所述标签数据进行更新。Step S240: Update the tag data in the update queue according to the data update speed corresponding to the update queue.
在本申请实施例中,步骤S240可以参阅前述实施例的内容,在此不再赘述。In the embodiment of the present application, step S240 can refer to the content of the foregoing embodiment, which will not be repeated here.
在一种实例中,请参阅图6,图6示出了本申请实施例提供的标签数据的更新方法的原理示意图,图中地理位置等时效性较强的标签数据,可以被识别为第一类型,从而缓存至第一缓冲队列704中,而其他时效性不强的标签数据,可以被识别为第二类型,而缓存至第二缓冲队列705中,并且第一缓冲队列对应有第一更新程序706,第二缓冲队列705对应有第二更新程序707,第一更新程序706对标签数据的更新速度可以大于第二更新程序707对标签数据的更新速度,第一更新程序706对标签数据的更新速度可以大于设定速度,而实现对地理位置等时效性较强的标签数据的实时更新。其中,第一更新程序706可以通过Flink、SparkStreaming、Storm、Samza等工具实现。In an example, please refer to FIG. 6. FIG. 6 shows a schematic diagram of the principle of a method for updating tag data provided by an embodiment of the present application. In the figure, tag data with strong timeliness such as geographic location can be identified as the first Type, so as to be cached in the first buffer queue 704, while other tag data with less timeliness can be identified as the second type and cached in the second buffer queue 705, and the first buffer queue corresponds to the first update Program 706, the second buffer queue 705 corresponds to the second update program 707. The update speed of the first update program 706 to the tag data can be greater than the update speed of the second update program 707 to the tag data. The first update program 706 updates the tag data. The update speed can be greater than the set speed, and real-time update of tag data with strong timeliness such as geographic location can be realized. Among them, the first update program 706 can be implemented by tools such as Flink, SparkStreaming, Storm, and Samza.
本申请实施例提供的标签数据的更新方法,通过在获得待更新的标签数据时,确定标签数据的类型,然后将标签数据缓存至第一类型对应的第一更新队列中,或者将标签数据缓存至第二类型对应的第二更新队列中,再按照该更新队列对应的数据更新速度,对更新队列中的标签数据进行更新。使得对于实时性级别高的标签数据,可以被实时更新,保障了标签数据的时效性。The method for updating tag data provided by the embodiments of the present application determines the type of tag data when obtaining tag data to be updated, and then caches the tag data in the first update queue corresponding to the first type, or caches the tag data In the second update queue corresponding to the second type, the tag data in the update queue is updated according to the data update speed corresponding to the update queue. This enables label data with a high real-time level to be updated in real time, ensuring the timeliness of label data.
请参阅图7,图7示出了本申请又一个实施例提供的标签数据的更新方法的流程示意图。该标签数据的更新方法应用于上述电子设备,下面将针对图7所示的流程进行详细的阐述,所述标签数据的更新方法具体可以包括以下步骤:Please refer to FIG. 7. FIG. 7 shows a schematic flowchart of a method for updating tag data provided by another embodiment of the present application. The method for updating label data is applied to the above-mentioned electronic equipment. The following will describe the process shown in FIG. 7 in detail. The method for updating label data may specifically include the following steps:
步骤S310:当获得待更新的标签数据时,获取所述标签数据的类型,不同类型的标签数据在更新时的实时性级别不同。Step S310: When the tag data to be updated is obtained, the type of the tag data is obtained. Different types of tag data have different real-time levels when updating.
在本申请实施例中,步骤S310可以参阅前述实施例的内容,在此不再赘述。In the embodiment of the present application, step S310 can refer to the content of the foregoing embodiment, which will not be repeated here.
步骤S320:确定所述类型对应的更新队列,并判断所述更新队列对应的数据更新速度是否大于设定速度。Step S320: Determine the update queue corresponding to the type, and determine whether the data update speed corresponding to the update queue is greater than the set speed.
步骤S330:如果所述更新队列对应的数据更新速度大于设定速度,获取处理器的 剩余利用率。Step S330: If the data update speed corresponding to the update queue is greater than the set speed, obtain the remaining utilization of the processor.
在本申请实施例中,由于更新队列对应的数据更新速度较大,更新时占用的处理器的资源也较多,并且如果处理器的剩余资源较少时,持续以较大更新速度对标签数据进行更新,则可能导致电子设备的运行崩溃。因此,可以确定该更新队列对应的数据更新速度,并在更新队列对应的数据更新速度大于设定速度时,获取处理器的剩余利用率,以便确定处理器的剩余资源是否处于较低的水平。而更新队列对应的数据更新速度小于或等于设定速度时,则可以将待更新的标签数据缓存至更新队列,后续对待更新的标签数据进行更新。其中,设定速度可以作为判断标签更新是否可能引起运行崩溃的判断依据,其具体大小可以不作为限定。In the embodiment of the present application, since the data update speed corresponding to the update queue is relatively large, the processor resources occupied during the update are also large, and if the remaining resources of the processor are small, the tag data is continuously updated at a relatively large update speed. The update may cause the operation of the electronic device to crash. Therefore, the data update speed corresponding to the update queue can be determined, and when the data update speed corresponding to the update queue is greater than the set speed, the remaining utilization rate of the processor is obtained, so as to determine whether the remaining resources of the processor are at a low level. When the data update speed corresponding to the update queue is less than or equal to the set speed, the tag data to be updated can be cached in the update queue, and the tag data to be updated is subsequently updated. Among them, the set speed can be used as a judgment basis for judging whether the label update may cause operation crash, and its specific size may not be used as a limitation.
步骤S340:如果所述剩余利用率高于设定利用率,将所述标签数据缓存至所述类型对应的更新队列。Step S340: If the remaining utilization rate is higher than the set utilization rate, buffer the tag data to the update queue corresponding to the type.
在本申请实施例中,如果处理器的剩余利用率高于设定利用率时,可以表示处理器的剩余资源较多,因此后续采用该更新队列对应的数据更新速度对标签数据进行更新,也不会引起电子设备运行崩溃,从而可以将标签数据缓存至该更新队列中。其中,设定利用率可以作为电子设备的运行是否会崩溃的判断依据,具体大小可不作为限定,例如,可以为10%,也可以为5%等。In the embodiment of the present application, if the remaining utilization rate of the processor is higher than the set utilization rate, it can indicate that the remaining resources of the processor are more. Therefore, the data update speed corresponding to the update queue is subsequently used to update the tag data. It will not cause the operation of the electronic device to crash, so that the tag data can be cached in the update queue. Among them, the set utilization rate can be used as a basis for judging whether the operation of the electronic device will crash, and the specific size is not limited, for example, it can be 10% or 5%.
步骤S350:如果所述剩余利用率小于或等于设定利用率,将所述标签数据缓存至目标更新队列,所述更新队列对应的数据更新速度大于所述目标更新队列对应的数据更新速度。Step S350: If the remaining utilization rate is less than or equal to the set utilization rate, buffer the tag data to a target update queue, and the data update speed corresponding to the update queue is greater than the data update speed corresponding to the target update queue.
在本申请实施例中,如果处理器的剩余利用率小于或等于设定利用率时,可以表示处理器的剩余资源较少,因此后续采用该更新队列对应的数据更新速度对标签数据进行更新,可能会引起电子设备运行崩溃。该情况下,则可以将标签数据缓存至数据更新速度相对较小的目标更新队列中,以避免对标签数据进行更新时,造成卡顿和崩溃。In the embodiment of the present application, if the remaining utilization rate of the processor is less than or equal to the set utilization rate, it can indicate that the remaining resources of the processor are less, so the tag data is updated subsequently using the data update speed corresponding to the update queue. It may cause the operation of electronic equipment to crash. In this case, the tag data can be cached in a target update queue with a relatively low data update speed to avoid jams and crashes when the tag data is updated.
步骤S360:按照所述更新队列对应的数据更新速度,对所述更新队列中的所述标签数据进行更新。Step S360: Update the tag data in the update queue according to the data update speed corresponding to the update queue.
在本申请实施例中,步骤S360可以参阅前述实施例的内容,在此不再赘述。In the embodiment of the present application, step S360 can refer to the content of the foregoing embodiment, which will not be repeated here.
本申请实施例提供的标签数据的更新方法,通过在获得待更新的标签数据时,确定标签数据的类型,然后该类型对应的更新队列,并在更新队列的更新速度大于设定速度时,获取处理器的剩余利用率,在剩余利用率大于设定利用率时,才将待更新的标签数据缓存至该更新队列,而剩余利用率小于或等于设定利用率时,将待更新的标签数据缓存至目标更新队列,再按照该更新队列对应的数据更新速度,对更新队列中的标签数据进行更新。使得对于实时性级别高的标签数据,可以被实时更新,保障了标签数据的时效性,并且避免了电子设备运行时的崩溃。The method for updating tag data provided by the embodiments of the present application determines the type of tag data when obtaining the tag data to be updated, and then the update queue corresponding to the type, and when the update speed of the update queue is greater than the set speed, obtain The remaining utilization rate of the processor. When the remaining utilization rate is greater than the set utilization rate, the tag data to be updated will be cached to the update queue. When the remaining utilization rate is less than or equal to the set utilization rate, the tag data to be updated will be cached. Cache to the target update queue, and then update the tag data in the update queue according to the data update speed corresponding to the update queue. This enables label data with a high real-time level to be updated in real time, guarantees the timeliness of the label data, and avoids the crash of the electronic device during operation.
请参阅图8,图8示出了本申请再一个实施例提供的标签数据的更新方法的流程示意图。该标签数据的更新方法应用于上述电子设备,下面将针对图8所示的流程进行详细的阐述,所述标签数据的更新方法具体可以包括以下步骤:Please refer to FIG. 8. FIG. 8 shows a schematic flowchart of a method for updating tag data provided by another embodiment of the present application. The method for updating label data is applied to the above-mentioned electronic equipment. The following will describe the process shown in FIG. 8 in detail. The method for updating label data may specifically include the following steps:
步骤S410:当获得待更新的标签数据时,获取所述标签数据的类型,不同类型的标签数据在更新时的实时性级别不同。Step S410: When the tag data to be updated is obtained, the type of the tag data is obtained. Different types of tag data have different real-time levels when updating.
步骤S420:将所述标签数据缓存至所述类型对应的更新队列,其中,不同更新队列对应不同的数据更新速度。Step S420: Buffer the tag data in the update queue corresponding to the type, where different update queues correspond to different data update speeds.
在本申请实施中,步骤S410以及步骤S420可以参阅前述实施例的内容,在此不再赘述。In the implementation of this application, step S410 and step S420 can refer to the content of the foregoing embodiment, which will not be repeated here.
步骤S430:如果所述类型为设定类型时,根据所述更新队列中的所有标签数据每个标签数据的类型,对所述所有标签数据进行排序。Step S430: If the type is the set type, sort all the tag data according to the type of each tag data of all the tag data in the update queue.
在一些实施方式中,更新队列可以对应多种类型的标签数据,也就是说,电子设 备可以将实时性级别不同的标签数据缓存于同一更新队列中。例如,电子设备中可以建立有更新队列1以及更新队列2,标签数据对应的实时性级别分为实时性级别1、实时性级别2、实时性级别3和实时性级别4,则实时性级别1和实时性级别2的标签数据可以缓存于更新队列1,实时性级别3和实时性级别4的标签数据可以缓存于更新队列2。这样的话,待更新的标签数据缓存至的更新队列中可能存在多个类型的标签数据(即多个实时性级别的标签数据),该情况下,还可以根据标签数据的类型的不同,对标签数据在更新队列中的位置进行排序。In some embodiments, the update queue can correspond to multiple types of tag data, that is, the electronic device can cache tag data with different real-time levels in the same update queue. For example, the electronic device can have update queue 1 and update queue 2, and the real-time level corresponding to the tag data is divided into real-time level 1, real-time level 2, real-time level 3, and real-time level 4, then real-time level 1 Tag data of real-time level 2 and real-time level 2 can be cached in update queue 1, and tag data of real-time level 3 and real-time level 4 can be cached in update queue 2. In this case, there may be multiple types of tag data (ie, multiple real-time levels of tag data) in the update queue to which the tag data to be updated is cached. In this case, the tag data can also be adjusted according to the type of tag data. The position of the data in the update queue is sorted.
在一些实施方式中,设定类型对应的实时性级别可以为最高实时性级别,即该设定类型的标签数据对于更新时的实时性需求非常高。另外,电子设备对更新队列中的标签数据进行更新时,是根据更新队列中标签数据的排布顺序,依次读取每个标签数据,并对每个标签数据进行更新,也就是说,缓冲队列为先进先出、后进后出的原则,按照更新队列中标签数据的排布顺序依次取出标签数据,并对标签数据进行更新。因此对于设定类型的标签数据,可以合理的使该标签数据尽早被更新,从而如果待更新的标签数据的类型为设定类型时,还可以在将标签数据缓存至更新队列中,对更新队列中的标签数据进行排序。In some embodiments, the real-time level corresponding to the setting type may be the highest real-time level, that is, the label data of the setting type has a very high demand for real-time performance when updating. In addition, when the electronic device updates the tag data in the update queue, it reads each tag data in turn according to the arrangement order of the tag data in the update queue, and updates each tag data, that is, the buffer queue For the principle of first-in, first-out and last-in-last-out, the label data is taken out in sequence according to the arrangement order of the label data in the update queue, and the label data is updated. Therefore, for the tag data of the set type, the tag data can be updated as soon as possible. Therefore, if the type of the tag data to be updated is the set type, the tag data can also be cached in the update queue to update the update queue. Sort the label data in.
作为一种方式,请参阅图9,步骤S430可以包括:As a way, referring to FIG. 9, step S430 may include:
步骤S431A:判断所述更新队列中是否存在除所述标签数据以外的所述设定类型的其他标签数据。Step S431A: Determine whether there is other tag data of the set type other than the tag data in the update queue.
步骤S432A:如果所述更新队列中不存在所述设定类型的其他标签数据,将所述标签数据排至所述更新队列中的队首。Step S432A: If there is no other tag data of the set type in the update queue, sort the tag data to the head of the update queue.
步骤S433A:如果所述更新队列中存在所述其他标签数据,将所述标签数据排至所述更新队列中所述其他标签数据后并且与所述其他标签数据相邻的位置。Step S433A: If the other tag data exists in the update queue, sort the tag data to a position adjacent to the other tag data after the other tag data in the update queue.
可以理解的,如果待更新的标签数据的类型为设定类型时,可以将该标签数据进行插队,也就是将该标签数据插入至靠前的位置。为了尽可能的使得该待更新的标签数据在更新队列中处于靠前的位置,则可以确定是否更新队列中是否存在设定类型的其他标签数据。由于其他标签数据对于更新时的实时性需求也非常高,并且比待更新的标签数据更早缓存至更新队列,因此不能使得待更新的标签数据在更新队列中的位置比其他标签数据的位置靠前。从而可以在更新队列中不存在其他标签数据时,可以将待更新的标签数据排至更新队列中的队首,而更新队列中存在其他标签数据时,则可以在更新队列中,将待更新的标签数据排至在其他标签数据的位置之后,并且与其他标签数据相邻的位置,使得待更新的标签数据尽可能的处于靠前的位置,保证待更新的标签数据能较早的被更新,使待更新的标签数据的时效性能较好得到保证。It is understandable that if the type of the tag data to be updated is the set type, the tag data can be inserted into the queue, that is, the tag data can be inserted to the front position. In order to make the tag data to be updated at the top of the update queue as much as possible, it can be determined whether there is other tag data of a set type in the update queue. Since other tag data has a very high demand for real-time performance during update, and it is cached in the update queue earlier than the tag data to be updated, it is impossible to make the position of the tag data to be updated in the update queue closer to the position of other tag data. before. Therefore, when there is no other tag data in the update queue, the tag data to be updated can be queued to the top of the update queue, and when there are other tag data in the update queue, the tag data to be updated can be placed in the update queue. The label data is arranged after the position of other label data and is adjacent to other label data, so that the label data to be updated is in the front position as much as possible, ensuring that the label data to be updated can be updated earlier. The timeliness performance of the label data to be updated is better guaranteed.
作为另一种方式,请参阅图10,步骤S430可以包括:As another way, referring to FIG. 10, step S430 may include:
步骤S431B:根据所述更新队列中的每个标签数据的类型,确定所述每个标签数据对应的优先级。Step S431B: Determine the priority corresponding to each tag data according to the type of each tag data in the update queue.
步骤S432B:根据所述每个标签数据对应的优先级的高低顺序,对所述所有标签数据中不同优先级的标签数据进行排序。Step S432B: Sort the tag data with different priorities in all the tag data according to the order of the priority corresponding to each tag data.
步骤S433B:如果所述更新队列中存在相同优先级的标签数据,根据标签数据缓存至所述更新队列的时间的先后顺序,对所述相同优先级的标签数据进行排序。Step S433B: If tag data of the same priority exists in the update queue, sort the tag data of the same priority according to the sequence of the time when the tag data is cached in the update queue.
在该方式下,在对更新队列中的标签数据进行排序时,也可以根据标签数据的优先级进行排序。其中,由于不同类型的标签数据对应的实时性级别不同,因此可以根据已确定出的标签数据的类型,确定更新队列中每个标签数据的类型,并根据类型确定每个标签数据的优先级。并且标签数据对应的实时性级别越高,则其优先级可以越高。例如,标签数据的类型为C1,其对应的实时性级别为D1,标签数据的类型为C2,其对应的实时性级别为D2,如果D1大于D2,则C1类型的标签数据对应的优先级为第一优先级,C2类型的标签数据对应的优先级为第二优先级,且第一优先级大于第二 优先级。In this way, when sorting the tag data in the update queue, it can also be sorted according to the priority of the tag data. Among them, since different types of tag data correspond to different real-time levels, the type of each tag data in the update queue can be determined according to the determined type of tag data, and the priority of each tag data can be determined according to the type. And the higher the real-time level corresponding to the tag data, the higher its priority can be. For example, the type of tag data is C1, its corresponding real-time level is D1, the type of tag data is C2, and its corresponding real-time level is D2, if D1 is greater than D2, the corresponding priority of C1 type tag data is The first priority, the priority corresponding to the C2 type tag data is the second priority, and the first priority is greater than the second priority.
电子设备在确定出优先级的高低顺序之后,则可以按照优先级从高到低的顺序,对所有标签数据中不同优先级的标签数据进行排序。并且对于相同优先级的标签数据,按照缓存至更新队列的时间的先后顺序,对相同优先级的标签数据进行排序。从而也能使得待更新的标签数据尽可能的处于更新队列中靠前的位置,使待更新的标签数据的时效性能较好得到保证。After the electronic device determines the order of priority, it can sort the tag data of different priorities in all tag data in the order of priority from high to low. And for the tag data of the same priority, the tag data of the same priority is sorted according to the sequence of the time when it is cached in the update queue. As a result, the tag data to be updated can be placed at the front position in the update queue as much as possible, so that the timeliness performance of the tag data to be updated can be better guaranteed.
步骤S440:按照所述更新队列对应的数据更新速度,对所述更新队列中的所述标签数据进行更新。Step S440: Update the tag data in the update queue according to the data update speed corresponding to the update queue.
本申请实施例中,通过在获得待更新的标签数据时,确定标签数据的类型,然后将标签数据缓存至该类型对应的更新队列中,并且根据更新队列中标签数据的类型,对更新队列中标签数据的位置进行排序,再按照该更新队列对应的数据更新速度,对更新队列中的标签数据进行更新,使得获得的标签数据被更新的速度,与其对应的实时性级别对应,从而对于实时性级别高的标签数据,可以快速的被更新,保障了标签数据的时效性。另外,使得待更新的标签数据尽可能的处于更新队列中靠前的位置,使待更新的标签数据的时效性能较好得到保证。In the embodiment of the present application, when the tag data to be updated is obtained, the type of the tag data is determined, and then the tag data is cached in the update queue corresponding to the type, and the update queue is updated according to the type of the tag data in the update queue. The position of the tag data is sorted, and then the tag data in the update queue is updated according to the data update speed corresponding to the update queue, so that the speed at which the obtained tag data is updated corresponds to its corresponding real-time level. High-level label data can be updated quickly, ensuring the timeliness of label data. In addition, the tag data to be updated is made to be at the front position in the update queue as much as possible, so that the timeliness performance of the tag data to be updated is better guaranteed.
请参阅图11,其示出了本申请实施例提供的一种标签数据的更新装置400的结构框图。该标签数据的更新装置400包括:类型获取模块410、数据缓存模块420以及数据更新模块430。其中,所述类型获取模块410用于当获得待更新的标签数据时,获取所述标签数据的类型,不同类型的标签数据在更新时的实时性级别不同;所述数据缓存模块420用于将所述标签数据缓存至所述类型对应的更新队列,其中,不同更新队列对应不同的数据更新速度;所述数据更新模块430用于按照所述更新队列对应的数据更新速度,对所述更新队列中的所述标签数据进行更新。Please refer to FIG. 11, which shows a structural block diagram of a tag data updating apparatus 400 provided by an embodiment of the present application. The tag data updating device 400 includes: a type obtaining module 410, a data caching module 420, and a data updating module 430. The type obtaining module 410 is used to obtain the type of the tag data when the tag data to be updated is obtained. Different types of tag data have different real-time levels when updating; the data caching module 420 is used to The tag data is cached in the update queue corresponding to the type, wherein different update queues correspond to different data update speeds; the data update module 430 is configured to update the update queue according to the data update speed corresponding to the update queue. The tag data in is updated.
在一些实施方式中,请参阅图12,所述类型获取模块410可以包括标识获取单元411以及第一类型确定单元412。其中,所述标识获取单元411用于获取所述标签数据中的类型标识,所述类型标识用于表征标签数据的类型;所述第一类型确定单元412用于根据所述类型标识,确定所述标签数据的类型。In some embodiments, referring to FIG. 12, the type obtaining module 410 may include an identification obtaining unit 411 and a first type determining unit 412. Wherein, the identification acquiring unit 411 is configured to acquire the type identification in the tag data, and the type identification is used to characterize the type of tag data; the first type determining unit 412 is configured to determine the type identification according to the type identification. Describe the type of label data.
在另一些实施方式中,请参阅图13,所述类型获取模块410可以包括数据源获取单元413以及第二类型确定单元414。其中,所述数据源获取单元413用于获取所述标签数据的数据源;所述第二类型确定单元414用于根据所述数据源,确定所述标签数据的类型。In other embodiments, referring to FIG. 13, the type obtaining module 410 may include a data source obtaining unit 413 and a second type determining unit 414. The data source obtaining unit 413 is configured to obtain the data source of the tag data; the second type determining unit 414 is configured to determine the type of the tag data according to the data source.
在一些实施方式中,数据缓存模块420可以包括第一缓存单元以及第二缓存单元。第一缓存单元用于当所述类型为第一类型时,将所述标签数据缓存至第一更新队列;第二缓存单元用于当所述类型为第二类型时,将所述标签数据缓存至第二更新队列,其中,所述第一类型的标签数据对应的实时性级别大于所述第二类型的标签数据对应的实时性级别,所述第一更新队列对应的数据更新速度大于所述第二更新队列对应的数据更新速度。In some embodiments, the data caching module 420 may include a first caching unit and a second caching unit. The first buffer unit is used for buffering the tag data to the first update queue when the type is the first type; the second buffer unit is used for buffering the tag data when the type is the second type To the second update queue, wherein the real-time level corresponding to the first type of tag data is greater than the real-time level corresponding to the second type of tag data, and the data update speed corresponding to the first update queue is greater than the The data update speed corresponding to the second update queue.
在该方式下,第一缓存单元可以具体用于:当所述类型为第一类型时,判断所述第一更新队列中的当前数据量是否达到缓存阈值;如果所述当前数据量未达到缓存阈值,将所述标签数据缓存至第一更新队列。In this manner, the first caching unit may be specifically configured to: when the type is the first type, determine whether the current amount of data in the first update queue reaches the cache threshold; if the current amount of data does not reach the cache threshold, Threshold, buffer the tag data to the first update queue.
进一步的,第一缓存单元还可以用于:如果所述当前数据量达到缓存阈值,确定所述第一更新队列中每个标签数据缓存至所述第一更新队列后的缓存时长;获取所述第一更新队列中的第一标签数据,所述第一标签数据对应的缓存时长大于设定时长;从所述第一更新队列中清除所述第一标签数据后,如果所述第一更新队列中的当前数据量未达到所述缓存阈值,将所述标签数据缓存至所述第一更新队列。Further, the first caching unit may be further configured to: if the current amount of data reaches a caching threshold, determine the caching duration of each tag data in the first update queue after it is cached in the first update queue; and obtain the For the first tag data in the first update queue, the buffer duration corresponding to the first tag data is greater than the set duration; after the first tag data is cleared from the first update queue, if the first update queue The current amount of data in the database does not reach the cache threshold, and the tag data is cached in the first update queue.
在一些实施方式中,所述第一更新队列以及所述第二更新队列位于内存中。第一缓存单元还可以用于在所述从所述第一更新队列中清除所述第一标签数据之前,将所 述第一标签数据缓存至所述第二更新队列;或者将所述第一标签数据存储至本地磁盘。In some embodiments, the first update queue and the second update queue are located in memory. The first cache unit may also be used to cache the first tag data in the second update queue before the first tag data is cleared from the first update queue; or to store the first tag data in the second update queue. The label data is stored on the local disk.
在一些实施方式中,该标签数据的更新装置400还可以包括:标签信息获取模块、第一标签数据判断模块以及标签数据清除模块。其中,标签信息获取模块用于获取所述标签数据对应的用户标识以及标签名称;第一标签数据判断模块用于判断所述第一更新队列中是否存在第二标签数据,所述第二标签数据为与所述用户标识以及所述标签名称相同的标签数据;标签数据清除模块用于如果所述第一更新队列中存在所述第二标签数据,将所述第一更新队列中的所述第二标签数据清除。In some embodiments, the tag data updating device 400 may further include: a tag information acquisition module, a first tag data judgment module, and a tag data clearing module. Wherein, the tag information obtaining module is used to obtain the user identification and tag name corresponding to the tag data; the first tag data judging module is used to judge whether there is second tag data in the first update queue, and the second tag data Is the tag data that is the same as the user identification and the tag name; the tag data clearing module is used for removing the second tag data in the first update queue if the second tag data exists in the first update queue Second, the label data is cleared.
在一些实施方式中,数据缓存模块420可以包括速度判断单元、利用率获取单元以及缓存执行单元。速度判断单元用于判断所述更新队列对应的数据更新速度是否大于设定速度;利用率获取单元用于如果所述更新队列对应的数据更新速度大于设定速度,获取处理器的剩余利用率;缓存执行单元用于如果所述剩余利用率高于设定利用率,将所述标签数据缓存至所述类型对应的更新队列。In some embodiments, the data cache module 420 may include a speed judgment unit, a utilization rate acquisition unit, and a cache execution unit. The speed judgment unit is used to judge whether the data update speed corresponding to the update queue is greater than the set speed; the utilization rate acquisition unit is used to obtain the remaining utilization rate of the processor if the data update speed corresponding to the update queue is greater than the set speed; The cache execution unit is configured to, if the remaining utilization rate is higher than the set utilization rate, cache the tag data to the update queue corresponding to the type.
在该方式下,缓存执行单元还可以用于:如果所述剩余利用率小于或等于设定利用率,将所述标签数据缓存至目标更新队列,所述更新队列对应的数据更新速度大于所述目标更新队列对应的数据更新速度。In this manner, the cache execution unit may also be used to: if the remaining utilization rate is less than or equal to the set utilization rate, cache the tag data to the target update queue, and the data update speed corresponding to the update queue is greater than the The data update speed corresponding to the target update queue.
在一些实施方式中,所述更新队列对应多种类型的标签数据,标签数据的更新装置还可以包括:位置排序模块。位置排序模块用于在所述将所述标签数据缓存至所述类型对应的更新队列之后,如果所述类型为设定类型时,根据所述更新队列中的所有标签数据每个标签数据的类型,对所述所有标签数据进行排序。In some embodiments, the update queue corresponds to multiple types of tag data, and the device for updating tag data may further include a position sorting module. The position sorting module is configured to: after the tag data is cached in the update queue corresponding to the type, if the type is a set type, according to the type of each tag data in the update queue To sort all the tag data.
作为一种方式,位置排序模块可以具体用于:判断所述更新队列中是否存在除所述标签数据以外的所述设定类型的其他标签数据;如果所述更新队列中不存在所述设定类型的其他标签数据,将所述标签数据排至所述更新队列中的队首。As a way, the position sorting module may be specifically used to determine whether there is other tag data of the setting type other than the tag data in the update queue; if the setting does not exist in the update queue For other tag data of the type, the tag data is sorted to the head of the update queue.
进一步的,位置排序模块还可以用于:如果所述更新队列中存在所述其他标签数据,将所述标签数据排至所述更新队列中所述其他标签数据后并且与所述其他标签数据相邻的位置。Further, the position sorting module may also be used to: if the other tag data exists in the update queue, sort the tag data after the other tag data in the update queue and be the same as the other tag data. The location of the neighbor.
作为另一种方式,位置排序模块可以具体用于:根据所述更新队列中的所有标签数据每个标签数据的类型,确定所述每个标签数据对应的优先级;根据所述每个标签数据对应的优先级的高低顺序,对所述所有标签数据中不同优先级的标签数据进行排序。As another way, the position sorting module may be specifically configured to: determine the priority corresponding to each tag data according to the type of each tag data of all tag data in the update queue; Corresponding to the high and low order of priority, the tag data of different priorities in all the tag data are sorted.
进一步的,位置排序模块还可以用于:根据所述每个标签数据对应的优先级的高低顺序,对所述所有标签数据中不同优先级的标签数据进行排序之后,如果所述更新队列中存在相同优先级的标签数据,根据标签数据缓存至所述更新队列的时间的先后顺序,对所述相同优先级的标签数据进行排序。Further, the position sorting module may also be used to: according to the priority order of each tag data, after sorting the tag data of different priorities in all the tag data, if there is any tag data in the update queue The tag data of the same priority is sorted according to the sequence of the time when the tag data is cached in the update queue.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述装置和模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and conciseness of description, the specific working process of the device and module described above can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
在本申请所提供的几个实施例中,模块相互之间的耦合可以是电性,机械或其它形式的耦合。In the several embodiments provided in this application, the coupling between the modules may be electrical, mechanical or other forms of coupling.
另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware or software function modules.
综上所述,通过在获得待更新的标签数据时,获取标签数据的类型,不同类型的标签数据在更新时的实时性级别不同,然后将标签数据缓存至该类型对应的更新队列,按照更新队列对应的数据更新速度,对更新队列中的标签数据进行更新,从而实现对于不同实时性级别的标签数据,能进入到不同的更新队列中,并根据更新队列对应的数据更新速度,对标签数据进行更新,保证标签数据更新的实时性。In summary, by obtaining the type of tag data when obtaining the tag data to be updated, different types of tag data have different real-time levels when updating, and then the tag data is cached to the update queue corresponding to the type, and the tag data is cached in accordance with the update queue. The data update speed corresponding to the queue updates the tag data in the update queue, so that tag data of different real-time levels can be entered into different update queues, and the tag data is updated according to the data update speed corresponding to the update queue. Update to ensure the real-time update of label data.
请参考图14,其示出了本申请实施例提供的一种电子设备的结构框图。该电子设 备100可以是智能手机、平板电脑、电子书等能够运行应用程序的电子设备。本申请中的电子设备100可以包括一个或多个如下部件:处理器110、存储器120以及一个或多个应用程序,其中一个或多个应用程序可以被存储在存储器120中并被配置为由一个或多个处理器110执行,一个或多个程序配置用于执行如前述方法实施例所描述的方法。Please refer to FIG. 14, which shows a structural block diagram of an electronic device provided by an embodiment of the present application. The electronic device 100 may be an electronic device capable of running application programs, such as a smart phone, a tablet computer, or an e-book. The electronic device 100 in this application may include one or more of the following components: a processor 110, a memory 120, and one or more application programs. One or more application programs may be stored in the memory 120 and configured to be Or multiple processors 110 execute, and one or more programs are configured to execute the method described in the foregoing method embodiment.
处理器110可以包括一个或者多个处理核。处理器110利用各种接口和线路连接整个电子设备100内的各个部分,通过运行或执行存储在存储器120内的指令、程序、代码集或指令集,以及调用存储在存储器120内的数据,执行电子设备100的各种功能和处理数据。可选地,处理器110可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器110可集成中央处理器(Central Processing Unit,CPU)、图像处理器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责显示内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器110中,单独通过一块通信芯片进行实现。The processor 110 may include one or more processing cores. The processor 110 uses various interfaces and lines to connect various parts of the entire electronic device 100, and executes by running or executing instructions, programs, code sets, or instruction sets stored in the memory 120, and calling data stored in the memory 120. Various functions and processing data of the electronic device 100. Optionally, the processor 110 may adopt at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). A kind of hardware form to realize. The processor 110 may be integrated with one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), a modem, and the like. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is used for rendering and drawing of display content; the modem is used for processing wireless communication. It can be understood that the above-mentioned modem may not be integrated into the processor 110, but may be implemented by a communication chip alone.
存储器120可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory)。存储器120可用于存储指令、程序、代码、代码集或指令集。存储器120可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于实现至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等。存储数据区还可以存储终端100在使用中所创建的数据(比如电话本、音视频数据、聊天记录数据)等。The memory 120 may include random access memory (RAM) or read-only memory (Read-Only Memory). The memory 120 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 120 may include a program storage area and a data storage area, where the program storage area may store instructions for implementing the operating system and instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.) , Instructions used to implement the following various method embodiments, etc. The data storage area can also store data (such as phone book, audio and video data, chat record data) created by the terminal 100 during use.
请参考图15,其示出了本申请实施例提供的一种计算机可读存储介质的结构框图。该计算机可读介质800中存储有程序代码,所述程序代码可被处理器调用执行上述方法实施例中所描述的方法。Please refer to FIG. 15, which shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application. The computer-readable medium 800 stores program code, and the program code can be invoked by a processor to execute the method described in the foregoing method embodiment.
计算机可读存储介质800可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。可选地,计算机可读存储介质800包括非易失性计算机可读介质(non-transitory computer-readable storage medium)。计算机可读存储介质800具有执行上述方法中的任何方法步骤的程序代码810的存储空间。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。程序代码810可以例如以适当形式进行压缩。The computer-readable storage medium 800 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 800 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 800 has storage space for the program code 810 for executing any method steps in the above-mentioned methods. These program codes can be read from or written into one or more computer program products. The program code 810 may be compressed in a suitable form, for example.
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不驱使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the application, not to limit them; although the application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: The technical solutions recorded in the foregoing embodiments are modified, or some of the technical features thereof are equivalently replaced; these modifications or replacements do not drive the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims (20)

  1. 一种标签数据的更新方法,其特征在于,所述方法包括:A method for updating label data, characterized in that the method includes:
    当获得待更新的标签数据时,获取所述标签数据的类型,不同类型的标签数据在更新时的实时性级别不同;When the label data to be updated is obtained, the type of the label data is obtained, and different types of label data have different real-time levels when being updated;
    将所述标签数据缓存至所述类型对应的更新队列,其中,不同更新队列对应不同的数据更新速度;Buffering the tag data in the update queue corresponding to the type, where different update queues correspond to different data update speeds;
    按照所述更新队列对应的数据更新速度,对所述更新队列中的所述标签数据进行更新。The tag data in the update queue is updated according to the data update speed corresponding to the update queue.
  2. 根据权利要求1所述的方法,其特征在于,所述获取所述标签数据的类型,包括:The method according to claim 1, wherein said obtaining the type of said tag data comprises:
    获取所述标签数据中的类型标识,所述类型标识用于表征标签数据的类型;Acquiring a type identifier in the tag data, where the type identifier is used to characterize the type of the tag data;
    根据所述类型标识,确定所述标签数据的类型。According to the type identification, the type of the tag data is determined.
  3. 根据权利要求1所述的方法,其特征在于,所述获取所述标签数据的类型,包括:The method according to claim 1, wherein said obtaining the type of said tag data comprises:
    获取所述标签数据的数据源;Acquiring the data source of the tag data;
    根据所述数据源,确定所述标签数据的类型。According to the data source, the type of the tag data is determined.
  4. 根据权利要求1-3任一项所述的方法,其特征在于,所述将所述标签数据缓存至所述类型对应的更新队列,包括:The method according to any one of claims 1-3, wherein the buffering the tag data to the update queue corresponding to the type comprises:
    当所述类型为第一类型时,将所述标签数据缓存至第一更新队列;When the type is the first type, buffer the tag data to the first update queue;
    当所述类型为第二类型时,将所述标签数据缓存至第二更新队列,其中,所述第一类型的标签数据对应的实时性级别大于所述第二类型的标签数据对应的实时性级别,所述第一更新队列对应的数据更新速度大于所述第二更新队列对应的数据更新速度。When the type is the second type, the tag data is cached in the second update queue, wherein the real-time level corresponding to the first type of tag data is greater than the real-time level corresponding to the second type of tag data Level, the data update speed corresponding to the first update queue is greater than the data update speed corresponding to the second update queue.
  5. 根据权利要求4所述的方法,其特征在于,所述当所述类型为第一类型时,将所述标签数据缓存至第一更新队列,包括:The method according to claim 4, wherein when the type is the first type, buffering the tag data in a first update queue comprises:
    当所述类型为第一类型时,判断所述第一更新队列中的当前数据量是否达到缓存阈值;When the type is the first type, judging whether the current amount of data in the first update queue reaches a cache threshold;
    如果所述当前数据量未达到缓存阈值,将所述标签数据缓存至所述第一更新队列。If the current data volume does not reach the cache threshold, cache the tag data in the first update queue.
  6. 根据权利要求5所述的方法,其特征在于,所述方法还包括:The method according to claim 5, wherein the method further comprises:
    如果所述当前数据量达到缓存阈值,确定所述第一更新队列中每个标签数据缓存至所述第一更新队列后的缓存时长;If the current data volume reaches the cache threshold, determine the cache duration of each tag data in the first update queue after being cached in the first update queue;
    获取所述第一更新队列中的第一标签数据,所述第一标签数据对应的缓存时长大于设定时长;Acquiring the first tag data in the first update queue, and the buffer duration corresponding to the first tag data is greater than a set duration;
    从所述第一更新队列中清除所述第一标签数据后,如果所述第一更新队列中的当前数据量未达到所述缓存阈值,将所述标签数据缓存至所述第一更新队列。After the first tag data is cleared from the first update queue, if the current amount of data in the first update queue does not reach the cache threshold, the tag data is cached in the first update queue.
  7. 根据权利要求6所述的方法,其特征在于,所述第一更新队列以及所述第二更新队列位于内存中,在所述从所述第一更新队列中清除所述第一标签数据之前,所述方法还包括:The method according to claim 6, wherein the first update queue and the second update queue are located in a memory, and before the first tag data is cleared from the first update queue, The method also includes:
    将所述第一标签数据缓存至所述第二更新队列;或者Buffer the first tag data to the second update queue; or
    将所述第一标签数据存储至本地磁盘。Store the first label data to a local disk.
  8. 根据权利要求4-7任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 4-7, wherein the method further comprises:
    获取所述标签数据对应的用户标识以及标签名称;Obtaining the user ID and the label name corresponding to the label data;
    判断所述第一更新队列中是否存在第二标签数据,所述第二标签数据为与所述用户标识以及所述标签名称相同的标签数据;Determining whether there is second tag data in the first update queue, where the second tag data is tag data that is the same as the user identifier and the tag name;
    如果所述第一更新队列中存在所述第二标签数据,将所述第一更新队列中的所述 第二标签数据清除。If the second tag data exists in the first update queue, the second tag data in the first update queue is cleared.
  9. 根据权利要求1-8任一项所述的方法,其特征在于,所述将所述标签数据缓存至所述类型对应的更新队列,包括:The method according to any one of claims 1-8, wherein the buffering the tag data to the update queue corresponding to the type comprises:
    判断所述更新队列对应的数据更新速度是否大于设定速度;Judging whether the data update speed corresponding to the update queue is greater than the set speed;
    如果所述更新队列对应的数据更新速度大于设定速度,获取处理器的剩余利用率;If the data update speed corresponding to the update queue is greater than the set speed, obtain the remaining utilization rate of the processor;
    如果所述剩余利用率高于设定利用率,将所述标签数据缓存至所述类型对应的更新队列。If the remaining utilization rate is higher than the set utilization rate, buffer the tag data to the update queue corresponding to the type.
  10. 根据权利要求9所述的方法,其特征在于,所述方法还包括:The method according to claim 9, wherein the method further comprises:
    如果所述剩余利用率小于或等于设定利用率,将所述标签数据缓存至目标更新队列,所述更新队列对应的数据更新速度大于所述目标更新队列对应的数据更新速度。If the remaining utilization rate is less than or equal to the set utilization rate, the tag data is buffered in a target update queue, and the data update speed corresponding to the update queue is greater than the data update speed corresponding to the target update queue.
  11. 根据权利要求1-10任一项所述的方法,其特征在于,所述更新队列对应多种类型的标签数据,在所述将所述标签数据缓存至所述类型对应的更新队列之后,所述方法还包括:The method according to any one of claims 1-10, wherein the update queue corresponds to multiple types of tag data, and after the tag data is cached in the update queue corresponding to the type, The method also includes:
    如果所述类型为设定类型时,根据所述更新队列中的所有标签数据每个标签数据的类型,对所述所有标签数据进行排序。If the type is the set type, sort all the tag data according to the type of each tag data of all the tag data in the update queue.
  12. 根据权利要求11所述的方法,其特征在于,所述根据所述更新队列中的所有标签数据每个标签数据的类型,对所述所有标签数据进行排序,包括:The method according to claim 11, wherein the sorting all the tag data according to the type of each tag data of all the tag data in the update queue comprises:
    判断所述更新队列中是否存在除所述标签数据以外的所述设定类型的其他标签数据;Judging whether there is other tag data of the set type other than the tag data in the update queue;
    如果所述更新队列中不存在所述设定类型的其他标签数据,将所述标签数据排至所述更新队列中的队首。If there is no other tag data of the set type in the update queue, the tag data is sorted to the top of the queue in the update queue.
  13. 根据权利要求12所述的方法,其特征在于,所述方法还包括:The method according to claim 12, wherein the method further comprises:
    如果所述更新队列中存在所述其他标签数据,将所述标签数据排至所述更新队列中所述其他标签数据后并且与所述其他标签数据相邻的位置。If the other tag data exists in the update queue, the tag data is sorted to a position next to the other tag data in the update queue after the other tag data.
  14. 根据权利要求11所述的方法,其特征在于,所述根据所述更新队列中的所有标签数据每个标签数据的类型,对所述所有标签数据进行排序,包括:The method according to claim 11, wherein the sorting all the tag data according to the type of each tag data of all the tag data in the update queue comprises:
    根据所述更新队列中的每个标签数据的类型,确定所述每个标签数据对应的优先级;Determine the priority corresponding to each tag data according to the type of each tag data in the update queue;
    根据所述每个标签数据对应的优先级的高低顺序,对所述所有标签数据中不同优先级的标签数据进行排序。According to the priority order of each tag data, the tag data of different priorities in all the tag data are sorted.
  15. 根据权利要求14所述的方法,其特征在于,所述根据所述每个标签数据对应的优先级的高低顺序,对所述所有标签数据中不同优先级的标签数据进行排序之后,所述方法还包括:The method according to claim 14, characterized in that, after sorting the tag data of different priorities in all the tag data according to the priority order of each tag data, the method Also includes:
    如果所述更新队列中存在相同优先级的标签数据,根据标签数据缓存至所述更新队列的时间的先后顺序,对所述相同优先级的标签数据进行排序。If tag data of the same priority exists in the update queue, the tag data of the same priority is sorted according to the sequence of the time when the tag data is cached in the update queue.
  16. 一种标签数据的更新装置,其特征在于,所述装置包括:类型获取模块、数据缓存模块以及数据更新模块,其中,A device for updating label data, characterized in that the device includes: a type acquisition module, a data cache module, and a data update module, wherein:
    所述类型获取模块用于当获得待更新的标签数据时,获取所述标签数据的类型,不同类型的标签数据在更新时的实时性级别不同;The type acquisition module is used to acquire the type of the label data when the label data to be updated is obtained, and different types of label data have different real-time levels when being updated;
    所述数据缓存模块用于将所述标签数据缓存至所述类型对应的更新队列,其中,不同更新队列对应不同的数据更新速度;The data buffer module is configured to buffer the tag data in the update queue corresponding to the type, wherein different update queues correspond to different data update speeds;
    所述数据更新模块用于按照所述更新队列对应的数据更新速度,对所述更新队列中的所述标签数据进行更新。The data update module is configured to update the tag data in the update queue according to the data update speed corresponding to the update queue.
  17. 根据权利要求16所述的装置,其特征在于,所述类型获取模块包括标识获取单元以及第一类型确定单元,其中,The device according to claim 16, wherein the type acquiring module comprises an identification acquiring unit and a first type determining unit, wherein:
    所述标识获取单元用于获取所述标签数据中的类型标识,所述类型标识用于表征 标签数据的类型;The identification acquiring unit is used to acquire a type identification in the tag data, and the type identification is used to characterize the type of the tag data;
    所述第一类型确定单元用于根据所述类型标识,确定所述标签数据的类型。The first type determining unit is configured to determine the type of the tag data according to the type identifier.
  18. 根据权利要求16所述的装置,其特征在于,所述类型获取模块包括数据源获取单元以及第二类型确定单元,其中,The device according to claim 16, wherein the type acquisition module comprises a data source acquisition unit and a second type determination unit, wherein:
    所述数据源获取单元用于获取所述标签数据的数据源;The data source obtaining unit is used to obtain the data source of the tag data;
    所述第二类型确定单元用于根据所述数据源,确定所述标签数据的类型。The second type determining unit is configured to determine the type of the tag data according to the data source.
  19. 一种电子设备,其特征在于,包括:An electronic device, characterized in that it comprises:
    一个或多个处理器;One or more processors;
    存储器;Memory
    一个或多个应用程序,其中所述一个或多个应用程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于执行如权利要求1-15任一项所述的方法。One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute such as The method of any one of claims 1-15.
  20. 一种计算机可读取存储介质,其特征在于,所述计算机可读取存储介质中存储有程序代码,所述程序代码可被处理器调用执行如权利要求1-15任一项所述的方法。A computer-readable storage medium, wherein the computer-readable storage medium stores program code, and the program code can be called by a processor to execute the method according to any one of claims 1-15 .
PCT/CN2019/116679 2019-11-08 2019-11-08 Method and apparatus for updating tag data, electronic device, and storage medium WO2021087970A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201980100127.1A CN114365111A (en) 2019-11-08 2019-11-08 Method and device for updating label data, electronic equipment and storage medium
PCT/CN2019/116679 WO2021087970A1 (en) 2019-11-08 2019-11-08 Method and apparatus for updating tag data, electronic device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/116679 WO2021087970A1 (en) 2019-11-08 2019-11-08 Method and apparatus for updating tag data, electronic device, and storage medium

Publications (1)

Publication Number Publication Date
WO2021087970A1 true WO2021087970A1 (en) 2021-05-14

Family

ID=75848158

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/116679 WO2021087970A1 (en) 2019-11-08 2019-11-08 Method and apparatus for updating tag data, electronic device, and storage medium

Country Status (2)

Country Link
CN (1) CN114365111A (en)
WO (1) WO2021087970A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114217587A (en) * 2021-12-15 2022-03-22 之江实验室 Real-time comparison and aggregation method for multiple types of data of mimicry executive body

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118170768B (en) * 2024-05-14 2024-08-06 深圳市纷享互联科技有限责任公司 Associated data dynamic quasi-real-time computing system, electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070089087A1 (en) * 2005-10-13 2007-04-19 Connor Edward J Method for dynamically generating multiple views of three-dimensional models for utility networks
CN105574051A (en) * 2014-11-06 2016-05-11 阿里巴巴集团控股有限公司 Method for updating user satisfaction rule and processing system
CN108399553A (en) * 2018-03-02 2018-08-14 江苏电力信息技术有限公司 It is a kind of to consider geographical and circuit subordinate relation user characteristics label setting method
CN108846002A (en) * 2018-04-20 2018-11-20 广东数果科技有限公司 Label real time updating method and system
CN109376161A (en) * 2018-08-22 2019-02-22 中国平安人寿保险股份有限公司 Label data update method, device, medium and electronic equipment based on big data
CN110362332A (en) * 2019-06-25 2019-10-22 上海淇馥信息技术有限公司 It is a kind of to control the method, apparatus of program incremental update, electronic equipment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107844524A (en) * 2017-10-12 2018-03-27 金蝶软件(中国)有限公司 Data processing method, data processing equipment, computer equipment and storage medium
CN108933993B (en) * 2018-07-03 2021-08-24 平安科技(深圳)有限公司 Short message cache queue selection method and device, computer equipment and storage medium
CN108900434A (en) * 2018-07-18 2018-11-27 北京木瓜移动科技股份有限公司 Data collection distribution method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070089087A1 (en) * 2005-10-13 2007-04-19 Connor Edward J Method for dynamically generating multiple views of three-dimensional models for utility networks
CN105574051A (en) * 2014-11-06 2016-05-11 阿里巴巴集团控股有限公司 Method for updating user satisfaction rule and processing system
CN108399553A (en) * 2018-03-02 2018-08-14 江苏电力信息技术有限公司 It is a kind of to consider geographical and circuit subordinate relation user characteristics label setting method
CN108846002A (en) * 2018-04-20 2018-11-20 广东数果科技有限公司 Label real time updating method and system
CN109376161A (en) * 2018-08-22 2019-02-22 中国平安人寿保险股份有限公司 Label data update method, device, medium and electronic equipment based on big data
CN110362332A (en) * 2019-06-25 2019-10-22 上海淇馥信息技术有限公司 It is a kind of to control the method, apparatus of program incremental update, electronic equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114217587A (en) * 2021-12-15 2022-03-22 之江实验室 Real-time comparison and aggregation method for multiple types of data of mimicry executive body

Also Published As

Publication number Publication date
CN114365111A (en) 2022-04-15

Similar Documents

Publication Publication Date Title
CN109873904B (en) User message state reporting processing method, device and storage medium for message pushing
CN110019087B (en) Data processing method and system
US9830668B1 (en) Identifying top fans
WO2019169978A1 (en) Resource recommendation method and device
CN109241099B (en) Data query method and terminal equipment
US20170286377A1 (en) Narrative generation using pattern recognition
CN113779416B (en) Information recommendation method and device, electronic equipment and computer-readable storage medium
WO2021087970A1 (en) Method and apparatus for updating tag data, electronic device, and storage medium
WO2021068113A1 (en) Method and apparatus for compiling duration statistics, electronic device, and computer-readable medium
WO2017177455A1 (en) Message presentation method, device, and system
US20160026690A1 (en) Conversation analytics
CA3065275A1 (en) Utilizing optical character recognition (ocr) to remove biasing
CN110663039A (en) Dynamic content loading selection
WO2021114634A1 (en) Text annotation method, device, and storage medium
CN112328592A (en) Data storage method, electronic device and computer readable storage medium
US11893427B2 (en) Method for determining and notifying users of pending activities on CRM data
JP6507263B2 (en) Content filtering based on user mobile network and data plan
CN115016735A (en) Control method, device and medium for distributed cache system
CN114402313A (en) Label updating method and device, electronic equipment and storage medium
US11783123B1 (en) Generating a dynamic template for transforming source data
WO2021087981A1 (en) Tag data update method and apparatus, electronic device, and storage medium
CN113297267A (en) Data caching and task processing method, device, equipment and storage medium
CN112286930A (en) Method, device, storage medium and electronic equipment for resource sharing of redis business side
CN108173898A (en) The method, apparatus and terminal device of service are accessed for resource
CN110990148A (en) Method, device and medium for optimizing storage performance

Legal Events

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

Ref document number: 19951963

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19951963

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 19951963

Country of ref document: EP

Kind code of ref document: A1

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

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 28.10.2022)

122 Ep: pct application non-entry in european phase

Ref document number: 19951963

Country of ref document: EP

Kind code of ref document: A1