CN117312695A - User comment data cache optimization method, device and computer readable medium - Google Patents

User comment data cache optimization method, device and computer readable medium Download PDF

Info

Publication number
CN117312695A
CN117312695A CN202311161150.6A CN202311161150A CN117312695A CN 117312695 A CN117312695 A CN 117312695A CN 202311161150 A CN202311161150 A CN 202311161150A CN 117312695 A CN117312695 A CN 117312695A
Authority
CN
China
Prior art keywords
cache
comment data
survival time
data
comment
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202311161150.6A
Other languages
Chinese (zh)
Inventor
姜舒
侯利欣
黄振
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Bilibili Technology Co Ltd
Original Assignee
Shanghai Bilibili Technology Co Ltd
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 Shanghai Bilibili Technology Co Ltd filed Critical Shanghai Bilibili Technology Co Ltd
Priority to CN202311161150.6A priority Critical patent/CN117312695A/en
Publication of CN117312695A publication Critical patent/CN117312695A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

The application provides a user comment data cache optimization method, device and computer readable medium. Because the probability that most comment data is accessed again in a few days is low, the preset time length can be controlled at an hour level, the time length that the buffer memory space is occupied by invalidation can be effectively reduced by shortening the initial buffer memory survival time from a few days to an hour level, and meanwhile, the reset mechanism of the buffer memory survival time is set for the comment data accessed in the buffer memory survival time, so that the frequently accessed popular comment data can be stored in the buffer memory for a long time, and the access speed of the comment data is effectively improved.

Description

User comment data cache optimization method, device and computer readable medium
Technical Field
The present disclosure relates to the field of information technologies, and in particular, to a method and apparatus for optimizing user comment data cache, and a computer readable medium.
Background
With the development of internet technology, the internet becomes a more important information acquisition propagation channel besides the traditional media channel. For various multimedia information (such as audio, video, news, pictures, etc.) published on the internet, users comment on the multimedia information to express their own opinion of the multimedia information.
After comment data of a user is obtained, the comment data is generally stored in a cache by a comment-related server, so that the comment data can be quickly read when the comment data need to be accessed later. In the current storage scheme, when the server writes comment data into the cache, the server generally sets a cache survival time of about several days. Taking 3 days as an example, when the caching time of a certain comment data exceeds three days, and the corresponding caching survival time is out of date, the comment data is deleted from the cache at this time to clean the storage space of the cache. However, in a practical scenario, because the probability that each comment data is actually accessed is different, for example, some popular comment data may be frequently accessed for a period of time, while other comment data may not be accessed once until the cache survival time expires, which may result in a portion of cache space being wasted. Therefore, the existing comment data storage scheme has the problems that the utilization rate of the cache space is not high and the cache resource is wasted.
Disclosure of Invention
Aspects of the present application provide a method, an apparatus, and a computer readable medium for optimizing user comment data cache, so as to solve the problems of low utilization rate of cache space and cache resource waste in the current scheme.
In one aspect of the present application, a method for optimizing user comment data cache is provided, where the method includes:
comment data published by a user are obtained;
writing the comment data into a cache, and setting the cache survival time of a preset duration;
deleting the comment data from the cache when the cache survival time expires;
and searching the comment data in a cache when an access request about the comment data is acquired, and if the comment data is searched in the cache, reading the comment data from the cache to answer the access request and resetting the cache survival time of a preset duration.
Based on another aspect of the present application, there is also provided a user comment data cache optimization apparatus, where the apparatus includes:
the data receiving module is used for acquiring comment data published by a user;
the data writing module is used for writing the comment data into the cache and setting the cache survival time of a preset duration;
the data deleting module is used for deleting the comment data from the cache when the survival time of the cache is expired;
and the cache updating module is used for searching the comment data in the cache when the access request about the comment data is acquired, and reading the comment data from the cache if the comment data is searched in the cache so as to answer the access request, and resetting the cache survival time of a preset duration.
The embodiment of the application also provides electronic equipment, which comprises:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the user comment data cache optimization method described previously.
The embodiment of the application also provides a computer readable medium, on which computer program instructions are stored, the computer program instructions being executable by a processor to implement the foregoing user comment data cache optimization method.
In the user comment data cache optimization scheme provided by the embodiment of the application, comment data published by a user is firstly obtained, the comment data is written into a cache, the cache survival time of a preset duration is set, when the cache survival time expires, the comment data is deleted from the cache, when an access request about the comment data is obtained, the comment data is searched in the cache, if the comment data is searched in the cache, the comment data is read from the cache so as to answer the access request, and the cache survival time of the preset duration is reset. In an actual scene, the probability that most comment data is accessed again in a few days is low, so that the preset time length can be controlled at an hour level, the time length that the cache space is not occupied can be effectively reduced by shortening the initial cache survival time from a few days to the hour level, meanwhile, a reset mechanism of the cache survival time is set for the comment data accessed in the cache survival time, and the action of accessing the comment data can trigger the cache survival time to be reset, so that the frequently accessed popular comment data can be stored in a cache for a long time, and the access speed of the comment data is effectively improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments or the description of the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and that other drawings can be obtained according to these drawings without inventive effort for a person skilled in the art. Other features, objects and advantages of the present application will become more apparent upon reading of the detailed description of non-limiting embodiments, made with reference to the following drawings, in which:
fig. 1 is a process flow diagram of a method for optimizing user comment data cache according to an embodiment of the present application;
FIG. 2 is a process flow diagram of another method for optimizing user comment data cache according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a user comment data cache optimization device provided in an embodiment of the present application;
FIG. 4 is a schematic structural diagram of an electronic device suitable for implementing the embodiments of the present application;
the same or similar reference numbers in the drawings refer to the same or similar parts.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
In a typical configuration of the present application, the terminals, the devices of the services network each include one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer-readable media include both permanent and non-permanent, removable and non-removable media, and information storage may be implemented by any method or technology. The information may be computer program instructions, data structures, modules of the program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape storage or other magnetic storage devices, or any other non-transmission medium which can be used to store information that can be accessed by a computing device.
The embodiment of the application provides a user comment data cache optimization method, which comprises the steps of firstly obtaining comment data published by a user, writing the comment data into a cache, setting a cache survival time with preset duration, deleting the comment data from the cache when the cache survival time expires, searching the comment data in the cache when an access request about the comment data is obtained, and reading the comment data from the cache to answer the access request and resetting the cache survival time with preset duration if the comment data is searched in the cache. In an actual scene, the probability that most comment data is accessed again in a few days is low, so that the preset time length can be controlled at an hour level, the time length that the cache space is not occupied can be effectively reduced by shortening the initial cache survival time from a few days to the hour level, meanwhile, a reset mechanism of the cache survival time is set for the comment data accessed in the cache survival time, and the action of accessing the comment data can trigger the cache survival time to be reset, so that the frequently accessed popular comment data can be stored in a cache for a long time, and the access speed of the comment data is effectively improved.
In an actual scenario, the execution body of the method may be a user device, or a device formed by integrating the user device and a network device through a network, or may also be an application running on the device, where the user device includes, but is not limited to, various terminal devices such as a computer, a mobile phone, a tablet computer, and the network device includes, but is not limited to, a network host, a single network server, a plurality of network server sets, or a computer set based on cloud computing. Here, the Cloud is composed of a large number of hosts or web servers based on Cloud Computing (Cloud Computing), which is a kind of distributed Computing, one virtual computer composed of a group of loosely coupled computer sets.
Fig. 1 shows a process flow of a user comment data cache optimization method provided in an embodiment of the present application, which at least includes the following steps:
step S101, comment data posted by a user are obtained. The comment data refers to data generated by a user posting comments on multimedia information on the internet, for example, after the user browses a video1 in a video website, a comment1 is posted on the content of the video, and at this time, a server of the video website receives comment data1 generated by the comment action.
Step S102, writing the comment data into a cache, and setting the cache survival time of a preset duration. In an actual scenario, after the comment data is generated, the comment data may be used for various reasons, for example, a user who publishes the comment may need to modify the content of the comment, other users need to refer to the comment, and the like, all need to access the corresponding comment data from the server. Therefore, after the server acquires comment data posted by the user, the comment data needs to be saved so that the comment data can be accessed later.
The cache is generally based on memory and has the characteristic of high reading and writing performance, so that comment data can be written into the cache, and corresponding comment data can be read quickly during subsequent access. Meanwhile, considering the limited space of the cache, a corresponding cache survival Time (TTL) can be set for comment data written into the cache, wherein the cache survival Time corresponds To the life cycle of comment data stored in the cache, when the cache survival Time of one comment data is not expired, the comment data can be normally stored in the cache, and when the cache survival Time of the comment data is expired, the corresponding comment data is deleted from the cache.
Considering the characteristics of user comment posting and attention in the internet scene, the probability of attention in the first few hours after comment posting is higher, and the access request about the comment data is most likely to be received in this time period. Therefore, in this embodiment, the buffer survival time may be set to an hour level, which is generally set to be smaller than several days in the existing solution, so as to effectively reduce the duration of time that the buffer space is occupied by invalidation. In an actual scenario, the specific value of the buffer survival time may be set according to the needs of the actual scenario, for example, may be 3, 6, 10, 12 hours, or may be 50 minutes, 100 minutes, 200 minutes, or the like. In this embodiment, taking 6 hours as an example, when the comment data1 is stored in the buffer men, the buffer survival time TTL1 of the comment data1 may be set to 6 hours. The buffer survival time decreases with time, and when the buffer survival time TTL1 decreases to 0, the buffer survival time of the comment data1 expires.
Step S104, searching the comment data in a cache when the access request about the comment data is acquired, and if the comment data is searched in the cache, reading the comment data from the cache to answer the access request, and resetting the cache survival time of a preset duration.
Taking the foregoing scenario as an example, when an access request req1 about comment data1 is received, the comment data1 may be searched in the cache, and if the cache survival time TTL1 of the comment data1 is not yet expired at this time, the comment data1 should be stored in the cache, and the comment data1 may be searched by this query. Thus, the server can read comment data1 from the cache men to answer the access request, and at the same time, reset the cache survival time TTL1 of the comment data1. If the cache survival time has remained for 1 hour at the time of inquiry, the cache survival time is reset to 6 hours after the comment data1 is read. If the comment data1 is popular and is repeatedly accessed in a later period of time, each access can lead to the survival time of the comment data1 being reset to 6 hours, so that the comment data1 can be always stored in the cache, a server can conveniently and quickly read the comment data1, and the access request req1 about the comment data1 can be more effectively responded.
In addition, for the case that the cache survival time expires, step S103 may also be executed to clean up the corresponding comment data. Wherein, step S103 includes: and deleting the comment data from the cache when the cache survival time expires. Taking the comment data1 as an example, when the buffer survival time TTL1 is decremented to 0, the comment data1 is deleted from the buffer to clear the buffer space.
In an actual scene, the probability that most comment data are accessed again in a few days is low, so that the preset duration can be controlled at an hour level, and most comment data which cannot be accessed again can be cleaned from a cache after a few hours by shortening the initial cache survival time from a few days to the hour level, so that the duration that the cache space is occupied by invalidation can be effectively reduced. Meanwhile, in order to prevent the hot comment data from being cleaned out of the cache, a reset mechanism of the cache survival time is set for the comment data accessed in the cache survival time, and the action of accessing the comment data triggers the cache survival time to be reset, so that the frequently accessed hot comment data can be stored in the cache for a long time, and the access speed of the comment data is effectively improved. Compared with a cache cleaning mechanism for uniformly setting the cache survival time to be several days in the existing scheme, the scheme can perform personalized regulation and control on the storage time of different comment data in the cache more finely and flexibly, and effectively realizes optimization of cache resources.
In some embodiments of the present application, the comment data may also be written to persistent storage before the cache survival time expires. The persistent storage is used as a supplement to the cache, and is characterized by a larger capacity, but the data reading speed is slower, and a storage medium in the form of a hard disk or the like is generally adopted. Because comment data is cleaned in the cache when the cache survival time of the comment data expires, the comment data can be written into the persistent storage before the cache survival time expires, so that the comment data are prevented from being lost due to cleaning of the cache space.
Since the write operation into the persistent storage occupies a certain processing resource, the write process can be performed according to the actual load, for example, when the load of the server is lower than a certain preset value, the comment data can be written into the persistent storage, and if the load of the server is higher than the preset value, the write operation into the persistent storage can be performed later, so as to avoid affecting other processes.
In an actual scenario, since a temporary storage medium such as a memory is generally used as the cache, data in the cache is lost due to factors such as power failure, and in order to ensure that the data is not lost due to unexpected factors such as power failure, a synchronous write strategy may also be used in this embodiment, and when the comment data is written into the cache, the comment data is synchronously written into the persistent storage. By means of the method, the possibility of comment data loss is reduced as much as possible by writing the comment data into the persistent storage mode at the first time, and the data can be reliably stored.
Fig. 2 shows a process flow of a user comment data cache optimization method provided in the embodiment of the present application, where the method further includes the following processing steps in addition to steps S101 to S104 shown in fig. 1:
step S105, writing the comment data into a persistent storage before the buffer survival time expires. Taking comment data2 posted by another user as an example, the server stores the comment data2 into the cache men after receiving the comment data2, and sets the cache survival time TTL2 to be 6 hours. Before its cache survival time expires, the server may write comment data2 into the persistent storage store.
Step S106, when the access request about the comment data is acquired, if the comment data is not found in the cache, the comment data is read from the persistent storage to answer the access request. Taking the aforementioned comment data2 as an example, when the server receives the access request req2 for the comment data2, the comment data2 can be searched in the cache, if the survival time of the cache of the comment data2 is expired at this time, the comment data2 is deleted from the cache, and the comment data2 cannot be found from the cache by the query. At this time, the server can read the comment data2 from the persistent storage sto to answer the access request req2.
In the scheme, although the speed of reading comment data from the persistent storage is slower than that of directly reading comment data from a cache, in an actual read-write scene of the comment data, the number of the comment data which is received by an access request after the survival time of the cache is smaller, so that the degree of reduced access efficiency is limited, but cache resources can be saved greatly, and overall, higher resource utilization can be replaced with lower performance cost.
In other embodiments of the present application, after the comment data is read from the persistent storage to answer the access request, step S107 may also be performed to rewrite the comment data into a cache, and set a cache survival time of a preset duration. Taking the comment data2 as an example, the server may read the comment data2 from the persistent storage unit, and after responding to the access request req2, may simultaneously rewrite the comment data2 into the cache men, and set a cache survival time TTL2 of 6 hours. Thereafter, when there is an access request for comment data2 within 6 hours, the server can directly find the comment data2 from the cache men to answer the access request without going to the persistent store read. Therefore, the access speed can be improved in a future period of time, and the access performance and the resource utilization rate are balanced better.
In addition, since the setting of the survival time of the cache can affect the access performance and the resource utilization rate of the whole system, when the setting of the survival time of the cache is larger, the access performance is better and the resource utilization rate is correspondingly reduced, otherwise, when the setting of the survival time of the cache is smaller, the access performance is worse and the resource utilization rate is correspondingly improved. Therefore, how to set a more appropriate cache survival time will affect the overall performance of the present solution.
In the scheme of the embodiment of the application, a big data analysis mode can be adopted, and data statistics is performed through historical data to determine more proper cache survival time. Specifically, access interval information of historical comment data in a preset period can be counted, and the buffer survival time is determined according to the first quantile of the access interval information according to the numerical distribution condition of the access interval information.
The preset period may be set according to the needs of the actual scene, for example, the last several weeks or several months. The first quantile can also be set according to the requirement of an actual scene, for example, when the first quantile is set to be a higher quantile, such as a 99 quantile, a 95 quantile and the like, the survival time of the cache can be relatively longer, and at the moment, the access request can be better ensured to be capable of directly accessing the required comment data from the cache, but more storage space occupation can be caused; when the number of bits is set to be relatively low, for example, 50 quantiles, 70 quantiles, etc., the survival time of the cache is relatively short, and the occupation of the storage space can be reduced, but more access requests cannot directly access the required comment data from the cache.
In this embodiment, taking 99 quantiles as an example, the 99 quantiles of the access intervals can be counted according to the access interval information of the history comment data generated in several weeks or months, and the buffer survival time is further determined according to the 99 quantiles. For example, the buffer survival time may be rounded up in units of hours on a 99 quantile basis. In this embodiment, if the 99 quantile of the access interval information is calculated to be 5.2 hours from the access interval information of the history comment data in the past 1 month, it is possible to determine that the cache survival time is 6 hours. Therefore, the proper cache survival time can be calculated more accurately according to the historical data in a period of time, so that the cache survival time can adapt to the behavior trend of a user in a period of time, access performance and resource utilization rate are balanced more reasonably, and the overall performance of the scheme is improved.
In some embodiments of the present application, it may further be considered that different characteristics of each user, for example, due to different situations of each user, the posted comments are not focused by other users, which may cause some users to post comment data that may be frequently accessed. Thus, when the user accumulates enough data, the cache survival time can be more individually determined from the granularity of the user. Specifically, when the number of the historical comment data of the user is greater than a preset number, the access interval information of the historical comment data of the user can be counted, and then the cache survival time is determined according to the 99-bit number of the access interval information. For example, when determining the cache survival time of comment data1 posted by a user, the access interval information of the historical comment data posted by the user can be counted, and if the 99 quantile number of the access interval information of the historical comment data posted by the user is calculated to be 7.8 hours, the cache survival time of comment data1 can be determined to be 8 hours.
In addition, the embodiment of the application further provides user comment data cache optimization equipment, and the structure of the equipment is shown in fig. 3, and the equipment comprises a data receiving module 310, a data writing module 320, a data deleting module 330 and a cache updating module 340. The data receiving module 310 is configured to obtain comment data posted by a user. The data writing module 320 is configured to write the comment data into a cache, and set a cache survival time of a preset duration. The data deleting module 330 is configured to delete the comment data from the cache when the cache survival time expires. The cache update module 340 is configured to, when an access request about the comment data is obtained, search the comment data in a cache, and if the comment data is found in the cache, read the comment data from the cache to answer the access request, and reset a cache survival time for a preset duration.
Based on the same inventive concept, the embodiment of the application also provides an electronic device, where the corresponding method of the electronic device may be the training method and the image compression method of the image preprocessing model in the foregoing embodiment, and the principle of solving the problem is similar to that of the method. The electronic device provided by the embodiment of the application comprises: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the methods and/or aspects of the various embodiments of the present application described above.
The electronic device may be a user device, or a device formed by integrating the user device and a network device through a network, or may also be an application running on the device, where the user device includes, but is not limited to, various terminal devices such as a computer, a mobile phone, a tablet computer, and the network device includes, but is not limited to, a network host, a single network server, a plurality of network server sets, or a computer set based on cloud computing. Here, the Cloud is composed of a large number of hosts or web servers based on Cloud Computing (Cloud Computing), which is a kind of distributed Computing, one virtual computer composed of a group of loosely coupled computer sets.
Fig. 4 shows a structure of an apparatus suitable for implementing the method and/or technical solution in the embodiments of the present application, the apparatus 400 includes a central processing unit (CPU, central Processing Unit) 401, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 402 or a program loaded from a storage portion 408 into a random access Memory (RAM, random Access Memory) 403. In the RAM 403, various programs and data required for the system operation are also stored. The CPU 401, ROM 402, and RAM 403 are connected to each other by a bus 404. An Input/Output (I/O) interface 405 is also connected to bus 404.
The following components are connected to the I/O interface 405: an input section 406 including a keyboard, a mouse, a touch panel, a microphone, an infrared sensor, and the like; an output portion 407 including a display such as a Cathode Ray Tube (CRT), a liquid crystal display (LCD, liquid Crystal Display), an LED display, an OLED display, and a speaker; a storage portion 408 comprising one or more computer-readable media of hard disk, optical disk, magnetic disk, semiconductor memory, etc.; and a communication section 409 including a network interface card such as a LAN (local area network ) card, a modem, or the like. The communication section 409 performs communication processing via a network such as the internet.
In particular, the methods and/or embodiments of the present application may be implemented as a computer software program. For example, embodiments disclosed herein include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. The above-described functions defined in the method of the present application are performed when the computer program is executed by a Central Processing Unit (CPU) 401.
Another embodiment of the present application also provides a computer readable storage medium having stored thereon computer program instructions executable by a processor to implement the method and/or the technical solution of any one or more embodiments of the present application described above.
In particular, the present embodiments may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations of the present application may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowchart or block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of devices, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods may be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the elements is merely a logical function division, and there may be additional divisions in actual implementation, e.g., multiple elements or page components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in hardware plus software functional units.
The integrated units implemented in the form of software functional units described above may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium, and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and are not limiting thereof; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the corresponding technical solutions.
Furthermore, it is evident that the word "comprising" does not exclude other elements or steps, and that the singular does not exclude a plurality. A plurality of units or means recited in the apparatus claims can also be implemented by means of one unit or means in software or hardware. The order of execution between the steps is determined by the logical relationship between the steps, independent of the numerical value of the step sequence number. The terms first, second, etc. are used to denote a name, but not any particular order.

Claims (10)

1. A user comment data cache optimization method, wherein the method comprises:
comment data published by a user are obtained;
writing the comment data into a cache, and setting a cache survival time with preset duration, wherein the cache survival time is used for indicating the duration of time that the comment data can be stored in the cache;
searching the evaluation data in the cache when an access request about the evaluation data is acquired;
and if the comment data is found in the cache, reading the comment data from the cache to answer the access request, and resetting the cache survival time of a preset duration.
2. The method of claim 1, wherein the method further comprises:
counting access interval information of historical comment data in a preset period;
and determining the survival time of the cache according to the numerical distribution condition of the access interval information and the first quantile of the access interval information.
3. The method of claim 2, wherein counting access interval information of the historical comment data within the preset period includes:
and when the number of the historical comment data of the user is larger than the preset number, counting the access interval information of the historical comment data of the user.
4. The method of claim 1, wherein the method further comprises:
the comment data is written to persistent storage before the cache survival time expires.
5. The method of claim 1, wherein the method further comprises:
if the comment data is not found in the cache, the comment data is read from the persistent storage to answer the access request.
6. The method of claim 5, wherein after reading the comment data from the persistent storage to answer the access request, further comprising:
and rewriting the comment data into a cache, and setting the cache survival time of a preset duration.
7. The method of claim 4, wherein writing the comment data into persistent storage before the cache survival time expires, comprising:
the comment data is written to persistent storage in synchronization with the writing of the comment data to the cache.
8. A user comment data cache optimization apparatus, wherein the apparatus comprises:
the data receiving module is used for acquiring comment data published by a user;
the data writing module is used for writing the comment data into the cache and setting the cache survival time of a preset duration;
the data deleting module is used for deleting the comment data from the cache when the survival time of the cache is expired;
and the cache updating module is used for searching the comment data in the cache when the access request about the comment data is acquired, and reading the comment data from the cache if the comment data is searched in the cache so as to answer the access request, and resetting the cache survival time of a preset duration.
9. An electronic device, the electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 7.
10. A computer readable medium having stored thereon computer program instructions executable by a processor to implement the method of any of claims 1 to 7.
CN202311161150.6A 2023-09-08 2023-09-08 User comment data cache optimization method, device and computer readable medium Pending CN117312695A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311161150.6A CN117312695A (en) 2023-09-08 2023-09-08 User comment data cache optimization method, device and computer readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311161150.6A CN117312695A (en) 2023-09-08 2023-09-08 User comment data cache optimization method, device and computer readable medium

Publications (1)

Publication Number Publication Date
CN117312695A true CN117312695A (en) 2023-12-29

Family

ID=89283956

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311161150.6A Pending CN117312695A (en) 2023-09-08 2023-09-08 User comment data cache optimization method, device and computer readable medium

Country Status (1)

Country Link
CN (1) CN117312695A (en)

Similar Documents

Publication Publication Date Title
CN109947668B (en) Method and device for storing data
CN111159436B (en) Method, device and computing equipment for recommending multimedia content
CN109379395B (en) Interface data cache setting method and terminal equipment
CN113010818B (en) Access current limiting method, device, electronic equipment and storage medium
US9501512B2 (en) Optimizing storage in a publish / subscribe environment
CN109766362B (en) Data processing method and device
US8725684B1 (en) Synchronizing data stores
CN111124270B (en) Method, apparatus and computer program product for cache management
CN110837480A (en) Processing method and device of cache data, computer storage medium and electronic equipment
CN103177080B (en) The method and apparatus that file pre-reads
CN112463254A (en) Method, device and equipment for acquiring webpage loading time and storage medium
CN111930305A (en) Data storage method and device, storage medium and electronic device
US11621987B2 (en) Method for processing streaming media data
CN112068765A (en) Method, apparatus and computer program product for managing a storage system
CN105808451B (en) Data caching method and related device
CN115617255A (en) Management method and management device for cache files
CN115080625B (en) Caching method, device and equipment based on Spring Cache framework and storage medium
CN110427394B (en) Data operation method and device
CN117312695A (en) User comment data cache optimization method, device and computer readable medium
CN110019362B (en) Method and device for accessing database
CN111427920B (en) Data acquisition method, device, system, computer equipment and storage medium
CN111090633A (en) Small file aggregation method, device and equipment of distributed file system
CN112699116A (en) Data processing method and system
EP2896185B1 (en) Reducing network usage of computing device
CN114238419B (en) Data caching method and device based on multi-tenant SaaS application system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination