Metadata caching method and device
By obtaining and asynchronously notifying the update meta information service module in the file information synchronization service module to query the target metadata of the target file and writing it to the cache database, the file upload failure caused by network delay, cache instability, and database performance fluctuations in traditional metadata management methods is solved, and an efficient file upload process is achieved.
Patent Information
- Application Number
- CN202411928415.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-03-25
AI Technical Summary
When traditional metadata management methods face problems such as network latency, cache instability, and database performance fluctuations, they may lead to file synchronization failure, which in turn causes file upload failure.
The target metadata of the target file is obtained through the file information synchronization service module, and the update metadata service module is notified asynchronously to query the target metadata. When the update meta information service module queries the target metadata, it is written to the first cache database.
It realizes that when the user uploads the target file, the update meta information service module immediately asynchronously notifies the update of the target file and writes it to the cache database, thereby avoiding file upload failures caused by network delay, cache instability, database performance fluctuations and other problems.
Smart Images

Figure CN119697259A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of storage technology, and in particular, to a metadata caching method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] With the rapid development of information technology, various information systems and data storage platforms have emerged, resulting in a rapid increase in the scale of data generation, processing and storage. As an important part of data management, metadata management is becoming increasingly important.
[0003] At present, with the surge in the number of files, the update method of traditional metadata management may cause file synchronization failure due to network delays, cache instability, database performance fluctuations and other issues, resulting in the failure of multiple file uploads.
[0004] It should be noted that the above content is not necessarily prior art, nor is it intended to limit the scope of patent protection of this application. Summary of the invention
[0005] Embodiments of the present application provide a metadata caching method, apparatus, computer device, computer-readable storage medium, and computer program product to solve or alleviate one or more of the technical problems raised above.
[0006] One aspect of an embodiment of the present application provides a metadata caching method, the method comprising: Obtain target metadata of the target file through the file information synchronization service module; Through the file information synchronization service module, asynchronously notify the update metadata service module to query the target metadata; When the update metadata service module finds the target metadata, the target metadata is written into the first cache database.
[0007] Optionally, asynchronously notifying the update metadata service module to query the target metadata includes: Asynchronously sending a notification message to the update metadata service module in the form of a message queue, so that the update metadata service module generates a query request according to the notification message; wherein the notification message includes a file identifier of the target file and is used to indicate that the target metadata has been updated in the metadata database; The query request sent by the update metadata service module is received to query the target metadata from the metadata database.
[0008] Optionally, the metadata caching method further includes: In case that the update meta information service module receives the notification message, the update meta information service module notifies the second cache database to read the target metadata from the metadata database; The first cache database corresponds to a first link, the second cache database corresponds to a second link, and the first link is a newly added link independent of the second link.
[0009] Optionally, the metadata caching method further includes: In the case that the target metadata has been updated to the second cache database, an update message of the target metadata is received through the playback scheduling service module to read the target metadata from the second cache database.
[0010] Optionally, the metadata caching method further includes: In the case that the target metadata has been updated to the first cache database, the update metadata service module notifies the play scheduling service module so that the play scheduling service module reads the target metadata from the first cache database.
[0011] Optionally, the metadata caching method further includes: In response to receiving the target metadata acquisition request, acquiring first metadata from the first cache database and acquiring second metadata from the second cache database; comparing the first metadata and the second metadata; When the first metadata and the second metadata are inconsistent, the first metadata is selected to be used.
[0012] Optionally, the metadata caching method further includes: In the case that the first metadata does not exist, the second metadata is selected to be used.
[0013] Optionally, the metadata caching method further includes: If the first metadata does not exist, acquiring the first metadata from a metadata database; and The first metadata is transmitted to a first cache database.
[0014] Another aspect of an embodiment of the present application provides a metadata cache device, the device comprising: An acquisition module, used for acquiring target metadata of a target file through a file information synchronization service module; A notification module, used for asynchronously notifying the update metadata service module to query the target metadata through the file information synchronization service module; The writing module is used to write the target metadata into the first cache database when the update metadata service module queries the target metadata.
[0015] Another aspect of an embodiment of the present application provides a computer device, including: at least one processor; and a memory communicatively coupled to the at least one processor; Wherein: the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method as described above.
[0016] Another aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method described above is implemented.
[0017] Another aspect of an embodiment of the present application provides a computer program product, including a computer program, which implements the above-mentioned method when executed by a processor.
[0018] The above technical solution adopted in the embodiment of the present application may include the following advantages: when a user uploads a target file (for example, on-demand video, etc.), the target metadata of the target file is obtained through the file information synchronization service module. Then, through the file information synchronization service module, the update meta information service module is asynchronously notified to query the target metadata (for example, video clarity and resolution, etc.). In the case where the update meta information service module queries the target metadata, the target metadata is written to the first cache database. It can be seen that in the embodiment of the present application, as long as there is an update of the target file, the file information synchronization service module will immediately asynchronously notify the update meta information service module to query the target metadata corresponding to the target file and write it to the first cache database. There is no need to wait for the target file to be completely updated before proceeding with the update process of the next file, so that the user can successfully upload the target file. As a result, the upload of the file will not fail due to problems such as network delays, cache instability, and database performance fluctuations. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.
[0020] Figure 1 The following schematically shows an operating environment diagram of the metadata caching method according to the first embodiment of the present application; Figure 2 The flowchart of the metadata caching method according to the first embodiment of the present application is schematically shown; Figure 3 Schematically shows Figure 2 Flow chart of sub-steps of step S202; Figure 4 The newly added flow chart of the metadata caching method according to the first embodiment of the present application is schematically shown; Figure 5 The newly added flow chart of the metadata caching method according to the first embodiment of the present application is schematically shown; Fig. 6A and Figure 6B The following schematically shows an exemplary application flow chart of the present application; Figure 7 The overall flow chart of the embodiment of the present application is schematically shown; Figure 8 A block diagram of a metadata cache device according to Embodiment 2 of the present application is schematically shown; and Fig. 9 The hardware architecture diagram of the computer device according to the third embodiment of the present application is schematically shown. DETAILED DESCRIPTION
[0021] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0022] It should be noted that the descriptions involving "first", "second", etc. in the embodiments of the present application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0023] In the description of the present application, it should be understood that the numerical labels before the steps do not indicate the order in which the steps are executed, but are only used to facilitate the description of the present application and to distinguish each step, and therefore should not be understood as a limitation on the present application.
[0024] First, the following terms are explained: Partition tolerance: In a distributed system, due to network failure or node failure, the system may be divided into multiple parts that cannot communicate with each other, that is, partition occurs. The system is required to continue to run and provide some form of service in this case. This is a basic property that must be considered in the design of distributed systems, because network partitions are an inevitable phenomenon in distributed systems.
[0025] Consistency: In a distributed system, it is used to describe the state of data. It requires that the data on all nodes be updated synchronously, that is, the data on all nodes is consistent at any time. This ensures that the data seen by users on different nodes is the same.
[0026] Availability: In a distributed system, it is used to describe the system's ability to respond to user requests. A highly available system can respond to user requests quickly and reliably, and maintain service continuity even in the event of a failure.
[0027] High availability: refers to the ability to perform functions without interruption, representing the degree of availability of the system.
[0028] Secondly, to facilitate technical personnel in this field to understand the technical solutions provided by the embodiments of the present application, the relevant technologies are described below: When the metadata processing link faces problems such as network delays, cache instability, and database performance fluctuations, it may cause problems such as failure to synchronize the metadata of the manuscript (i.e., file) and blockage of the metadata processing link, thereby affecting user submissions.
[0029] To this end, the present application embodiment provides a metadata cache technical solution to overcome the above problems. See below for details.
[0030] Finally, for ease of understanding, an exemplary operating environment is provided below.
[0031] like Figure 1 As shown, the operating environment diagram includes: a service platform 2, and clients (4A, 4B, ..., 4N).
[0032] The service platform 2 can be connected to the client terminals ( 4A, 4B, ..., 4N) via the network.
[0033] The service platform 2 may be a single server, a server cluster or a cloud computing service center.
[0034] The service platform 2 can provide storage metadata services, transmission metadata services, etc. to the client.
[0035] The service platform 2 may be located in a data center such as a single location, or distributed in different geographical locations (e.g., in multiple locations). The service platform 2 may provide services via a network. The network includes various network devices such as routers, switches, multiplexers, hubs, modems, bridges, repeaters, firewalls, proxy devices, and / or the like. The network may include physical links such as coaxial cable links, twisted pair cable links, optical fiber links, combinations thereof, and the like, or wireless links such as cellular links, satellite links, Wi-Fi links, and the like.
[0036] The client (4A, 4B, ..., 4N) may be configured to access the content and services of the service platform 2. The client (4A, 4B, ..., 4N) may include an electronic device carrying or externally connected to a display panel, such as a mobile device, a tablet device, a laptop computer, a workstation, a virtual reality device, a gaming device, a digital streaming device, a vehicle terminal, a smart TV, a set-top box, etc., and may also include a virtualized computing instance. The virtualized computing instance may include a virtual machine, such as a simulation of a computer system, an operating system, a server, etc. The computing device may load a virtual machine based on a virtual image and / or other data defining specific software (e.g., an operating system, a dedicated application, a server) for simulation. As the demand for different types of processing services changes, different virtual machines may be loaded and / or terminated on one or more computing devices.
[0037] The client (4A, 4B, ..., 4N) may be associated with one or more users. A single user may also use one or more of the clients (4A, 4B, ..., 4N) to access the service platform 2. The client (4A, 4B, ..., 4N) may travel to various locations and use different networks to access the service platform 2.
[0038] The client (4A, 4B, ..., 4N) may include an interface. The interface may include a touch pad, a touch screen, a mouse, a keyboard, or other sensing elements. For example, the input element may be configured to receive user instructions, and the user instructions may enable the client (4A, 4B, ..., 4N) to perform various operations, such as playing a video, uploading a video, etc.
[0039] It should be noted that the above devices are exemplary, and the number and type of devices are adjustable in different scenarios or according to different needs.
[0040] The following uses the service platform 2 as the execution subject to introduce the technical solution of the present application through multiple embodiments. It should be noted that these embodiments can be implemented in a variety of different forms and should not be interpreted as being limited to the embodiments described here.
[0041] Embodiment 1 Figure 2The flowchart of the metadata caching method according to the first embodiment of the present application is schematically shown.
[0042] like Figure 2 As shown, the metadata caching method may include steps S200 to S204, wherein: Step S200, obtaining target metadata of the target file through the file information synchronization service module; Step S202, asynchronously notifying the update metadata service module to query the target metadata through the file information synchronization service module; Step S204: when the update metadata service module finds the target metadata, the target metadata is written into the first cache database.
[0043] The metadata caching method provided in this embodiment obtains the target metadata of the target file through the file information synchronization service module when the user uploads the target file (for example, on-demand video, etc.). Then, through the file information synchronization service module, the update metadata service module is asynchronously notified to query the target metadata (for example, video clarity and resolution, etc.). In the case where the update metadata service module queries the target metadata, the target metadata is written to the first cache database. It can be seen that in the embodiment of the present application, as long as there is an update of the target file, the file information synchronization service module will immediately asynchronously notify the update metadata service module to query the target metadata corresponding to the target file and write it to the first cache database. There is no need to wait for the target file to be completely updated before proceeding with the update process of the next file, so that the user can successfully contribute (i.e. upload the target file). As a result, the upload of the file will not fail due to problems such as network delays, cache instability, and database performance fluctuations.
[0044] It should be noted that in this implementation, in order to enable users to submit smoothly (i.e. upload target files), availability is given priority. Also, although the target metadata of the same target file may be different in a short period of time (for example, within 1 minute), the target metadata will eventually remain consistent across clients as time goes by.
[0045] The following combination Figure 2 and Figure 7 , each step in steps S200~S204 and other optional steps are described in detail.
[0046] Step S200 , obtain the target metadata of the target file through the file information synchronization service module.
[0047] Exemplarily, the target file may include video files (e.g., on-demand videos, short videos, movies, live content, etc.), audio files (e.g., music, podcasts, voice messages, etc.), image files (e.g., photos, illustrations, design drawings, etc.), document files, compressed files, executable files (e.g., software installation packages, etc.), script files, program source code files, database files, log files, etc. Target metadata is descriptive information of data. When the target file is a video file, the target metadata may include resolution, clarity, video format, encoding method, file creation time, modification time, access time, file size, file type (e.g., picture, video, etc.), security information, association information, geographic location information, and content summary.
[0048] For ease of understanding, you can combine Figure 7 When a user uploads a target file, the target metadata of the target file is obtained through the file process management service module. Then, the file process management service module transmits the target metadata to the file information synchronization service module. The file information synchronization service module then writes the target metadata into the metadata database.
[0049] Step S202 , through the file information synchronization service module, asynchronously notifies the update metadata service module to query the target metadata.
[0050] In some embodiments, after the file information synchronization service module completes writing the target metadata into the metadata database, it can call a predefined callback function to notify the update metadata service module. The callback function may include the file identifier of the target file or related information of the metadata so that the update metadata service module can query the target metadata accordingly. In some embodiments, if both the file information synchronization service module and the update metadata service module support the WebSocket protocol, a WebSocket connection can be established. After the file information synchronization service module completes writing the metadata into the metadata database, it can send a message to the update metadata service module via WebSocket to notify it to perform a metadata query.
[0051] It should be noted that the CAP (Consistency, Availability, Partition tolerance) theory points out that consistency, availability and partition tolerance cannot be achieved at the same time, and only two of them can be selected. Among them, partition tolerance refers to the ability of a distributed system to continue to provide services when network problems such as network partitions occur, which is a phenomenon that is bound to occur in a distributed system. Consistency means that the system provides services to users only after the metadata is updated to the latest state. Consistency can ensure that the attributes such as video clarity and resolution viewed by users are consistent. However, services cannot be provided in the face of network partitions or failures (i.e., availability is reduced). In an embodiment of the present application, as long as there is an update to the target file, the file information synchronization service module will immediately asynchronously notify the update metadata service module to query the target metadata corresponding to the target file and write it into the first cache database. There is no need to wait for the target file to be completely updated before the next file update process is carried out, so that users can successfully submit (i.e., upload the target file), ensuring availability. As a result, file upload failure will not be caused by problems such as network delays, cache instability, and database performance fluctuations.
[0052] As mentioned above, in order to enable users to submit (i.e. upload target files) smoothly, availability is selected. Although the target metadata of the same target file may be different in a short period of time (e.g., within 1 minute), the architecture system designed in the embodiment of the application (i.e. Figure 7 The overall system architecture shown in the figure can ensure that the target metadata (such as resolution and bitrate option information) is eventually consistent across clients over time (for example, after two minutes). This balances availability and consistency.
[0053] In an optional embodiment, if Figure 3 As shown, step S202 may include: Step S300, asynchronously sending a notification message to the update metadata service module in the form of a message queue, so that the update metadata service module generates a query request according to the notification message; wherein the notification message includes a file identifier of the target file and is used to indicate that the target metadata has been updated in the metadata database; Step S302: receiving the query request sent by the update metadata service module to query the metadata database for the target metadata.
[0054] Exemplarily, the file information synchronization service module can obtain the file identifier of the target file (such as file name, file ID, version number, etc.); then, generate a notification message containing the file identifier. In some embodiments, a timestamp, update type (such as new, modified, deleted, etc.) and other additional information (such as updater ID, update reason, etc.) can also be added to the notification message. The generated notification message is asynchronously sent to the selected message queue. In some embodiments, in order to reduce the possibility of failure in sending the notification message, a retry mechanism can be set.
[0055] After the update metadata service module receives and parses the notification message from the message queue, it can generate a query request based on the file identifier in the notification message. Then, the query request is sent to the file information synchronization service module through various methods such as internal interface or remote call (such as REST API, RPC, etc.). In response to the query request, the file information synchronization service module queries the target metadata from the metadata database.
[0056] In this embodiment, as long as the user uploads the target file, the metadata service module is asynchronously notified through the message queue to query the target metadata corresponding to the target file. There is no need to wait for the previous file to be completely updated before performing the update process of the target file. This not only allows users to submit smoothly, but also ensures processing efficiency and high availability.
[0057] Step S204 , when the update metadata service module queries the target metadata, the target metadata is written into the first cache database.
[0058] Exemplarily, the first cache database can be various databases such as MySQL, PostgreSQL, SQLite, Redis, Memcached, etc. In this embodiment, caching the target metadata in the first cache database can facilitate the subsequent determination of the parameters of the target file based on the target metadata. For example, the target file is determined based on the target metadata to allow the latest resolution bit rate option information to be scheduled. Among them, the resolution bit rate option information may include resolution (for example, standard definition, high definition, ultra-high definition, etc.), bit rate (for example, low bit rate, standard bit rate, high bit rate, etc.), frame rate (for example, 24FPS, 30FPS and 60FPS, etc.), etc.
[0059] In an optional embodiment, the metadata caching method may further include: In case that the update meta information service module receives the notification message, the update meta information service module notifies the second cache database to read the target metadata from the metadata database; The first cache database corresponds to a first link, the second cache database corresponds to a second link, and the first link is a newly added link independent of the second link.
[0060] It should be noted that for ease of understanding, Figure 7 (The red line in the figure is the old link, and the black line is the new link). In the embodiment of the present application, the first cache database (i.e., the new cache database) obtains the first metadata from the metadata database through the first link (i.e., the new link). The second cache database obtains the second metadata from the metadata database through the second link. The second cache database and its corresponding second link are the old cache database and old link that are to be gradually eliminated in the subsequent plan. In this way, the data of the new and old links are backed up with each other.
[0061] For example, in combination Figure 7 When the update metadata service module receives the notification message, the update metadata service module notifies the original cache management service module that the target metadata has been updated to the metadata database. Then, the original cache management service module instructs the second cache database to obtain the target metadata from the metadata database.
[0062] In an optional embodiment, the metadata caching method may further include: In the case that the target metadata has been updated to the second cache database, an update message of the target metadata is received through the playback scheduling service module to read the target metadata from the second cache database.
[0063] Combination Figure 7 When the target metadata corresponding to each target file has been updated to the second cache database, the original cache management service module notifies the playback scheduling service module to read the target metadata from the second cache database.
[0064] Based on the old link, the playback scheduling service module will only continue to execute the metadata update transmission process of the next file after successfully reading the target metadata of the target file from the second cache database. The above mechanism may cause synchronization failure when there are problems such as network delay, cache instability, and database performance fluctuations, thereby causing user submission blockage.
[0065] However, in the embodiment of the present application, once a file is updated, the file information synchronization service module does not need to wait for the response of the playback scheduling service module, but immediately and asynchronously notifies the update metadata service module, thereby reducing the direct dependency between the modules and allowing the modules to work in parallel, thereby improving the response speed and fault tolerance of the system.
[0066] In an optional embodiment, the metadata caching method may further include: In the case that the target metadata has been updated to the first cache database, the update metadata service module notifies the play scheduling service module so that the play scheduling service module reads the target metadata from the first cache database.
[0067] For example, in combination Figure 7 After confirming that the target metadata has been successfully updated to the first cache database, the update metadata service module can send a message containing the target file identifier to the playback scheduling service module in the form of a message queue. The message is used to indicate that the target metadata has been updated to the first database. When the playback scheduling service module receives the message, the playback scheduling service module will read the target metadata from the first cache database. In some embodiments, the API (Application Programming Interface) provided by the playback scheduling service module can also be called by the update metadata service module, passing the file identifier of the target file and the type of metadata to be read as parameters. After receiving this API call, the playback scheduling service module will immediately query and return the target metadata from the first cache database.
[0068] It should be noted that when the target metadata has been updated to the first cache database, the playback scheduling service module is notified to read the target metadata from the first cache database, and the file information synchronization service module is also notified to avoid repeatedly updating the target metadata to the first cache database.
[0069] In this embodiment, after receiving the notification that the target metadata has been updated, the playback scheduling service module immediately reads it from the first database, so that the parameters of the target file (ie, resolution bit rate option information) can be updated according to the read target metadata.
[0070] In an optional embodiment, if Figure 4 As shown, the metadata caching method may further include: Step S400, in response to receiving the target metadata acquisition request, acquiring first metadata from the first cache database and acquiring second metadata from the second cache database; Step S402, comparing the first metadata and the second metadata; Step S404: when the first metadata and the second metadata are inconsistent, the first metadata is selected to be used.
[0071] For example, in combination Figure 7In response to the playback scheduling service module receiving the metadata acquisition request of the target file, the playback scheduling service module simultaneously obtains the first metadata from the first cache database and the second metadata from the second cache database (it should be noted that the first metadata and the second metadata are both target metadata corresponding to the target file, but the first metadata and the second metadata may be the same or different. It is necessary to determine later whether the first metadata or the second metadata is used as the target metadata corresponding to the target file in the end). Compare whether the quantity and content of the first metadata and the second metadata are consistent. Among them, the compared content may include content information such as video resolution, clarity, and encoding format. Because the first cache database is more reliable than the first link, when the first metadata and the second metadata are inconsistent, the first metadata can be preferentially selected as the target metadata corresponding to the target file in the end. It should be noted that the final corresponding target metadata is subsequently used to determine the parameters of the target file (for example, the target video) (for example, the target video is ultimately allowed to schedule out the latest resolution bit rate option information).
[0072] In this embodiment, in response to a target metadata acquisition request, first metadata corresponding to the target file is acquired from the first cache database and second metadata corresponding to the target file is acquired from the second cache database. Since the first cache database is more reliable than the second cache database, when the first metadata and the second metadata are inconsistent, the first metadata is preferentially used as the target metadata that ultimately corresponds to the target file, thereby improving the reliability and accuracy of acquiring the target metadata that ultimately corresponds to the target file.
[0073] In an optional embodiment, the metadata caching method may further include: In the case that the first metadata does not exist, the second metadata is selected to be used.
[0074] Exemplarily, when the playback scheduling service module simultaneously obtains the first metadata from the first cache database and the second metadata from the second cache database, if the first metadata exists and is valid, the first metadata can be directly used as the target metadata that ultimately corresponds to the target file. If the target metadata (i.e., the first metadata) corresponding to the target file cannot be queried from the first cache database, but the target metadata (and the second metadata) corresponding to the target file can be queried from the second cache database, the second metadata can be selected as the metadata that ultimately corresponds to the target file.
[0075] In some embodiments, the acquisition priority of the target metadata can be set. Specifically, the first metadata can be first acquired from the first cache database as the target metadata that the target file ultimately corresponds to. In the case where the first metadata does not exist, has expired, is in an incorrect format, or does not match the target file, the second metadata is acquired from the second cache database as the target metadata that the target file ultimately corresponds to.
[0076] In this embodiment, in response to the target metadata acquisition request, the playback scheduling service module simultaneously reads the metadata of the first cache database and the second cache database. If the metadata corresponding to the target file (i.e., the first metadata) does not exist in the first cache database, the second metadata is selected as the target metadata. That is, through the mutual complementation between the new cache database and the old cache database, the success rate of the playback scheduling service module in acquiring the target metadata corresponding to the target file is improved, and the accuracy and timeliness of the playback scheduling can be guaranteed as much as possible.
[0077] In an optional embodiment, if Figure 5 As shown, the metadata caching method may further include: Step S500: if the first metadata does not exist, obtain the first metadata from a metadata database; and Step S502: transmitting the first metadata to a first cache database.
[0078] Exemplarily, in response to a request to obtain target metadata, the playback scheduling service module immediately retrieves the first metadata from the metadata database through the first link and stores it in the first cache database if the first metadata corresponding to the target file cannot be queried from the first cache database, so that when the target metadata is requested again subsequently, the first metadata exists in the first cache database, so that the first metadata can be used as the target metadata.
[0079] Combination Figure 7 By ensuring that the new system (the first cache database and the first link corresponding to the first cache database) can obtain and store complete target metadata as much as possible, the dependence on the old system (the second cache database and the second link corresponding to the first cache database) is gradually reduced, so that the old system can be completely replaced in the future.
[0080] In order to make this application easier to understand, the following Fig. 6A , 6B and Figure 7 An exemplary application is provided.
[0081] Step S600: When the on-demand video manuscript is updated, the file flow management service module obtains metadata corresponding to the updated on-demand video manuscript.
[0082] Step S602, transmitting metadata corresponding to the on-demand video manuscript to the file information synchronization service module.
[0083] Step S604: the file information synchronization service module writes the metadata corresponding to the on-demand video manuscript into the metadata database.
[0084] Step S606, when the metadata corresponding to the on-demand video manuscript is written into the metadata database, the file information synchronization service module asynchronously sends a notification message to the update metadata service module in the form of a message queue.
[0085] Step S608: The update meta information service receives the notification message and then sends a query request to the file information synchronization service module.
[0086] Step S610: the file information synchronization service module queries the metadata corresponding to the on-demand video manuscript from the metadata database in response to the query request.
[0087] Step S612: the file information synchronization service module returns the metadata corresponding to the retrieved on-demand video manuscript to the update metadata service module.
[0088] Step S613, the update meta-information service module synchronizes the metadata corresponding to the on-demand video manuscript to the new cache database (ie, the first cache database).
[0089] Step S614, the play scheduling service module responds to the acquisition request of the on-demand video manuscript, and reads and compares the metadata corresponding to the on-demand video manuscript in the new cache database and the old cache database (i.e., the second cache database). It should be noted that in the process of acquiring metadata through the new link and storing it in the new cache database, the embodiment of the present application also acquires metadata through the old link and stores it in the old cache database.
[0090] Step S616, when the metadata obtained from the new cache database is inconsistent with the metadata obtained from the old cache database, the playback scheduling service module selects to use the metadata corresponding to the on-demand video manuscript obtained from the new cache database as the final metadata corresponding to the on-demand video manuscript.
[0091] Step S618, when there is no metadata corresponding to the on-demand video manuscript in the new cache database, the playback scheduling service module selects to use the metadata obtained from the old database as the metadata ultimately corresponding to the on-demand video manuscript.
[0092] Step S620: The playback scheduling service module determines the resolution bit rate option information that the on-demand video manuscript is allowed to be scheduled based on the metadata that the on-demand video manuscript ultimately corresponds to.
[0093] Embodiment 2 Figure 8 The block diagram of the metadata cache device according to the second embodiment of the present application is schematically shown. The device can be divided into one or more program modules, one or more program modules are stored in a storage medium, and are executed by one or more processors to complete the embodiment of the present application. The program module referred to in the embodiment of the present application refers to a series of computer program instruction segments that can complete specific functions. The following description will specifically introduce the functions of each program module in this embodiment. Figure 8 As shown, the device 1000 may include: an acquisition module 1100, a notification module 1200, and a writing module 1300, wherein: An acquisition module 1100 is used to acquire target metadata of a target file through a file information synchronization service module; The first notification module 1200 is used to asynchronously notify the update metadata service module to query the target metadata through the file information synchronization service module; The writing module 1300 is used to write the target metadata into the first cache database when the update metadata service module queries the target metadata.
[0094] In an optional embodiment, the asynchronous notification update meta information service module queries the target metadata, including: Asynchronously sending a notification message to the update metadata service module in the form of a message queue, so that the update metadata service module generates a query request according to the notification message; wherein the notification message includes a file identifier of the target file and is used to indicate that the target metadata has been updated in the metadata database; The query request sent by the update metadata service module is received to query the target metadata from the metadata database.
[0095] In an optional embodiment, the metadata cache device further includes a second notification module: In case that the update meta information service module receives the notification message, the update meta information service module notifies the second cache database to read the target metadata from the metadata database; The first cache database corresponds to a first link, the second cache database corresponds to a second link, and the first link is a newly added link independent of the second link.
[0096] In an optional embodiment, the metadata cache device further includes a receiving module: In the case that the target metadata has been updated to the second cache database, an update message of the target metadata is received through the playback scheduling service module to read the target metadata from the second cache database.
[0097] In an optional embodiment, the metadata caching device further includes a third notification module: In the case that the target metadata has been updated to the first cache database, the update metadata service module notifies the play scheduling service module so that the play scheduling service module reads the target metadata from the first cache database.
[0098] In an optional embodiment, the metadata cache device further includes a first selection module: In response to receiving the target metadata acquisition request, acquiring first metadata from the first cache database and acquiring second metadata from the second cache database; comparing the first metadata and the second metadata; When the first metadata and the second metadata are inconsistent, the first metadata is selected to be used.
[0099] In an optional embodiment, the metadata cache device further includes a second selection module: In the case that the first metadata does not exist, the second metadata is selected to be used.
[0100] In an optional embodiment, the metadata cache device further includes a transmission module: If the first metadata does not exist, acquiring the first metadata from a metadata database; and The first metadata is transmitted to a first cache database.
[0101] Embodiment 3 Fig. 9 The schematic diagram of the hardware architecture of a computer device 10000 suitable for implementing the metadata caching method according to the third embodiment of the present application is shown schematically. In some embodiments, the computer device 10000 may be a terminal device such as a smart phone, a wearable device, a tablet computer, a personal computer, a vehicle terminal, a game console, a virtual device, a workbench, a digital assistant, a set-top box, a robot, etc. In other embodiments, the computer device 10000 may be a rack server, a blade server, a tower server, or a cabinet server (including an independent server, or a server cluster composed of multiple servers), etc. Fig. 9 As shown, the computer device 10000 includes but is not limited to: a memory 10010, a processor 10020, and a network interface 10030 that can communicate with each other through a system bus. Among them: The memory 10010 includes at least one type of computer-readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (such as SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 10010 can be an internal storage module of the computer device 10000, such as a hard disk or memory of the computer device 10000. In other embodiments, the memory 10010 can also be an external storage device of the computer device 10000, such as a plug-in hard disk equipped on the computer device 10000, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 10010 can also include both the internal storage module of the computer device 10000 and its external storage device. In this embodiment, the memory 10010 is generally used to store the operating system and various application software installed in the computer device 10000, such as program code of the metadata caching method, etc. In addition, the memory 10010 can also be used to temporarily store various data that have been output or will be output.
[0102] In some embodiments, the processor 10020 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other chips. The processor 10020 is generally used to control the overall operation of the computer device 10000, such as performing control and processing related to data interaction or communication with the computer device 10000. In this embodiment, the processor 10020 is used to run the program code stored in the memory 10010 or process data.
[0103] The network interface 10030 may include a wireless network interface or a wired network interface, and the network interface 10030 is generally used to establish a communication link between the computer device 10000 and other computer devices. For example, the network interface 10030 is used to connect the computer device 10000 to an external terminal through a network, and to establish a data transmission channel and a communication link between the computer device 10000 and the external terminal. The network may be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, etc.
[0104] It should be pointed out that Fig. 9 Only a computer device having components 10010 - 10030 is shown, but it should be understood that implementation of all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.
[0105] In this embodiment, the metadata caching method stored in the memory 10010 can also be divided into one or more program modules and executed by one or more processors (such as processor 10020) to complete the embodiment of the present application.
[0106] Embodiment 4 An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, wherein when the computer program is executed by a processor, the steps of the metadata caching method in the embodiment are implemented.
[0107] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the computer-readable storage medium may be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium may also be an external storage device of a computer device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device. Of course, the computer-readable storage medium may also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the computer-readable storage medium is generally used to store an operating system and various application software installed on the computer device, such as the program code of the metadata caching method in the embodiment. In addition, the computer-readable storage medium may also be used to temporarily store various types of data that have been output or are to be output.
[0108] Embodiment 5 An embodiment of the present application also provides a computer program product, including a computer program, which implements the method in the above embodiment when executed by a processor.
[0109] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present application can be implemented by general-purpose computer devices, they can be concentrated on a single computer device, or distributed on a network composed of multiple computer devices, optionally, they can be implemented by executable program codes of computer devices, so that they can be stored in a storage device and executed by the computer device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.
[0110] It should be noted that the above are only preferred embodiments of the present application, and the patent protection scope of the present application is not limited thereto. Any equivalent structure or equivalent process transformation made using the contents of the specification and drawings of the present application, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A metadata caching method, characterized in that: The method comprises: Obtain target metadata of the target file through the file information synchronization service module; Through the file information synchronization service module, asynchronously notify the update metadata service module to query the target metadata; When the update metadata service module finds the target metadata, the target metadata is written into the first cache database.
2. The method according to claim 1, characterized in that The asynchronous notification update meta information service module queries the target metadata, including: Asynchronously sending a notification message to the update metadata service module in the form of a message queue, so that the update metadata service module generates a query request according to the notification message; wherein the notification message includes a file identifier of the target file, and the notification message is used to indicate that the target metadata has been updated in the metadata database; The query request sent by the update metadata service module is received to query the target metadata from the metadata database.
3. The method according to claim 2, characterized in that The method further comprises: In case that the update meta information service module receives the notification message, the update meta information service module notifies the second cache database to read the target metadata from the metadata database; The first cache database corresponds to a first link, the second cache database corresponds to a second link, and the first link is a newly added link independent of the second link.
4. The method according to claim 3, characterized in that The method further comprises: In the case that the target metadata has been updated to the second cache database, an update message of the target metadata is received through the playback scheduling service module to read the target metadata from the second cache database.
5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: In the case that the target metadata has been updated to the first cache database, the update metadata service module notifies the play scheduling service module so that the play scheduling service module reads the target metadata from the first cache database.
6. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: In response to receiving the target metadata acquisition request, acquiring first metadata from the first cache database and acquiring second metadata from the second cache database; comparing the first metadata and the second metadata; When the first metadata and the second metadata are inconsistent, the first metadata is selected to be used.
7. The method according to claim 6, characterized in that The method further comprises: In the case that the first metadata does not exist, the second metadata is selected to be used.
8. The method according to claim 6, characterized in that The method further comprises: If the first metadata does not exist, acquiring the first metadata from a metadata database; and The first metadata is transmitted to a first cache database.
9. A metadata cache device, characterized in that: The device comprises: An acquisition module, used for acquiring target metadata of a target file through a file information synchronization service module; A notification module, used for asynchronously notifying the update metadata service module to query the target metadata through the file information synchronization service module; The writing module is used to write the target metadata into the first cache database when the update metadata service module queries the target metadata.
10. A computer device, characterized in that: include: at least one processor; and a memory communicatively coupled to the at least one processor; wherein: The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 8 is implemented.
12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to claims 1 to 8 are implemented.