Data cache processing method, device, equipment and storage medium
By monitoring and adjusting the cache occupancy rate of the cache module in real time, the problem of overflow or empty data in the cache area in electronic devices is solved, and the stable and reliable output of the data flow is achieved.
Patent Information
- Application Number
- CN202210153552.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-18
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2042-02-18
AI Technical Summary
When an electronic device performs the actions required for the data flow, there is a problem that data in the buffer overflows and is lost or becomes empty and abnormally mutations.
By obtaining the real-time cache occupancy of the cache module and adjusting the cached data queue according to the preset threshold range, ensure that the real-time cache occupancy of the cache module is always within the preset threshold range.
It effectively avoids the problem of overflow of data in the cache module, batch loss or null, and abnormal mutation, ensuring that the number of data is always maintained within a certain range, improving the stability and reliability of the data flow.
Smart Images

Figure CN114510362B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a data cache processing method, device, equipment and storage medium. Background Art
[0002] In the field of electronic devices, actuator modules such as speakers and linear motors can provide sound and vibration feedback, giving users a good experience. During the control process, actuator modules such as speakers and linear motors usually need to process the input data to obtain a data stream, and then place the data stream in the cache module. The power circuit of the actuator module then receives the data from the cache module.
[0003] However, when an electronic device executes an action required by a data stream, there is a problem of abnormal mutation after data overflows and is lost in the buffer area or becomes empty.
[0004] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention
[0005] The main purpose of the present invention is to provide a data cache processing method, device, equipment and storage medium, aiming to solve the problem of abnormal mutation after data overflow and loss or empty in the cache area of electronic equipment.
[0006] To achieve the above objectives, in a first aspect, the present invention provides a data cache processing method, comprising:
[0007] Get the real-time cache occupancy rate of the cache module;
[0008] Determining whether the real-time cache occupancy rate is within a preset threshold range;
[0009] If it is not within the preset threshold range, the cached data queue of the cache module is adjusted so that the real-time cache occupancy rate of the cache module after adjustment is within the preset threshold range.
[0010] In one embodiment, the step of adjusting the cached data queue of the cache module so that the real-time cache occupancy rate of the cache module after adjustment is within the preset threshold range includes:
[0011] According to a preset adjustment step, the cached data queue is divided into at least one sub-data queue; the sub-data queue includes at least one data point;
[0012] For any of the sub-data queues, determining a target data point from at least one of the data points;
[0013] The target data point is adjusted so that the real-time cache occupancy rate of the cache module after adjustment is within the preset threshold range.
[0014] In one embodiment, for any of the sub-data queues, determining a target data point from at least one of the data points includes:
[0015] For any of the sub-data queues, a target data point having the smallest absolute value of the modulus of the data point is selected from at least one of the data points.
[0016] In one embodiment, the adjusting the cached data queue of the cache module includes:
[0017] If the real-time cache occupancy rate is greater than or equal to a preset occupancy rate upper limit value within the preset threshold range, the target data point is deleted.
[0018] In one embodiment, the adjusting the cached data queue of the cache module includes:
[0019] If the real-time cache occupancy rate is less than or equal to the preset occupancy rate lower limit value of the preset threshold range, the target data point is copied to obtain a copied data point, and the copied data point is cached.
[0020] In one embodiment, the caching the replicated data points includes:
[0021] The duplicate data point is inserted and cached at a position adjacent to the target data point in the cached data queue.
[0022] In a second aspect, the present invention further provides a data cache processing device, comprising:
[0023] An occupancy acquisition module is used to obtain the real-time cache occupancy of the cache module;
[0024] An occupancy rate determination module is used to determine whether the real-time cache occupancy rate is within a preset threshold range;
[0025] The data adjustment module is used to adjust the cached data queue of the cache module if the data queue is not within the preset threshold range, so that the real-time cache occupancy rate of the cache module after adjustment is within the preset threshold range.
[0026] In a third aspect, the present invention further provides an electronic device, comprising:
[0027] A data stream processing module, used for outputting action data stream;
[0028] A cache module, the cache module is used to receive and cache the action data stream to obtain a cached data queue;
[0029] a data flow adjustment module, configured to obtain a real-time cache occupancy rate of a cache module; determine whether the real-time cache occupancy rate is within a preset threshold range; if not within the preset threshold range, adjust the cached data queue of the cache module so that the real-time cache occupancy rate of the cache module after adjustment is within the preset threshold range;
[0030] The execution module is used to read the adjusted cached data queue in the cache module and execute the corresponding action of the adjusted cached data queue.
[0031] In one embodiment, the execution module is further used to read the adjusted cached data queue in the cache module and execute corresponding actions of the adjusted cached data queue when it is detected that the real-time cache occupancy in the cache module reaches a preset startup threshold for the first time.
[0032] In a fourth aspect, the present invention further provides a computer-readable storage medium, on which a data cache processing program is stored, and when the data cache processing program is executed by a processor, the data cache processing method as described above is implemented.
[0033] The present invention proposes a data cache processing method, device, equipment and storage medium, which obtains the real-time cache occupancy of a cache module; determines whether the real-time cache occupancy is within a preset threshold range; if it is not within the preset threshold range, adjusts the cached data queue of the cache module so that the real-time cache occupancy of the cache module after adjustment is within the preset threshold range.
[0034] Therefore, the present invention dynamically adjusts the cached data queue of the cache module through the real-time cache occupancy rate, so that the real-time cache occupancy rate is always maintained within the preset threshold range, so that the number of data in the cache module is always maintained within a certain range, thereby improving the phenomenon of data overflow and batch loss in the cache module, or the occurrence of abnormal mutations due to empty data in the cache module. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 A schematic diagram of the structure of the electronic device for this application;
[0036] Figure 2 This is a flow chart of the first embodiment of the data cache processing method of this application;
[0037] Figure 3 This is a flow chart of the second embodiment of the data cache processing method of this application;
[0038] Figure 4 This is a module diagram of the data cache processing device of this application;
[0039] Figure 5 A real-time cache occupancy curve diagram of an electronic device according to an embodiment of the present application;
[0040] Figure 6 This is a partial diagram of a real-time cache occupancy curve diagram of an electronic device according to an embodiment of the present application.
[0041] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0042] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0043] In the field of electronic products, sound-generating devices such as speakers can provide sound, and vibration devices such as linear motors can provide vibration feedback, both of which can bring users a good user experience. During the control process, execution modules such as sound-generating devices and vibration devices usually require data stream input modules to process the input action data stream through specific algorithms, and then output them to the power circuit to drive execution modules such as speakers and linear motors to achieve specific functions such as frequency domain widening, low-frequency enhancement, and noise reduction required by the applications carried by electronic devices. Due to the limitations of electronic product hardware design and crystal oscillator consistency differences, the data stream output sampling rate of the data stream input module and the data stream receiving sampling rate of the power circuit driving the execution module are difficult to be completely consistent, and there are usually certain differences. When the data stream output sampling rate is greater than the data stream receiving sampling rate, the power circuit does not have time to execute all the action data streams output by the data stream input module, resulting in the problem of batch data loss; when the data stream output sampling rate is less than the data stream receiving sampling rate, the power circuit will have no data to receive, and then play random data to cause abnormal mutations. To this end, the prior art generally uses a data cache module that occupies a large space, and gradually fills the action data stream output by the data stream input module into the cache module. When the action data stream output by the data stream input module fills half of the cache space of the cache module, the power circuit is called to receive and execute the action data from the cache module. In this way, when the data stream output sampling rate is greater than the data stream reception sampling rate, the data volume of the cache module will gradually increase from half of the total space; when the data stream output sampling rate is less than the data stream reception sampling rate, the data volume of the cache module will gradually decrease from half of the total space. Under normal circumstances, the storage space of the cache module is set large enough, and short-term playback will not cause the data of the cache module to overflow or be empty, so that the action data stream can be output without loss or abnormal mutation.
[0044] However, the existing method will still cause problems of batch data loss or abnormal mutation when executing the actions required by the data flow for a long time. At the same time, the setting of an ultra-large buffer also brings problems of large signal delay and large software storage space occupation.
[0045] To this end, the present embodiment provides a data cache processing method, which dynamically adjusts the cached data queue according to the real-time cache occupancy of the cache module to always maintain the number of data in the cache module within a certain range, thereby improving the phenomenon of data overflow and batch loss in the cache module, or the occurrence of abnormal mutations due to empty data in the cache module.
[0046] The inventive concept of the present application is further explained below in conjunction with some specific implementation methods.
[0047] See also Figure 1 , Figure 1 An electronic device is shown, comprising:
[0048] The data stream processing module 100 is used to output an action data stream. Specifically, the data stream processing module 100 is used to receive action data streams generated by various applications of the electronic device in response to user actions. For example, when the electronic device is an enhanced display device, the action data stream may be a vibration data stream required by a game program on the enhanced display device for a better gaming experience, so as to control the linear motor of the enhanced display device to perform vibration actions. The action data stream may be an analog signal or a digital signal, which is not limited in this embodiment.
[0049] It is worth mentioning that the data stream processing module 100 can perform algorithmic processing on the input action data stream according to the actual control requirements of the program being run by the electronic device, and then output the processed action data stream. The control requirements can be functions such as frequency domain widening, low-frequency enhancement, and noise reduction. If there is no control requirement, the data stream processing module 100 does not process the input action data stream and directly outputs it. Among them, the output rate of the data stream processing module 100 is the data stream output sampling rate.
[0050] The cache module 200 is used to receive and cache the action data stream to obtain a cached data queue. Specifically, the cache module 200 is used to store in real time the action data stream output by the data stream processing module 100. It can be understood that the cache module 200 can be a divided cache area.
[0051] The data flow adjustment module 300 is used to obtain the real-time cache occupancy of the cache module 200; determine whether the real-time cache occupancy is within a preset threshold range; if not within the preset threshold range, adjust the cached data queue of the cache module 200 so that the real-time cache occupancy of the cache module 200 after adjustment is within the preset threshold range.
[0052] The execution module 400 is used to read the adjusted cached data queue in the cache module 200 and execute the corresponding action of the adjusted cached data queue. For example, the execution module 400 can be a power circuit of a speaker or a linear motor, which reads the action data stream from the cache module 200 in real time and converts it into a voltage output with power driving capability to drive the speaker to generate sound or the linear motor to generate vibration feedback. The sampling rate at which the execution module 400 obtains the action data stream from the cache area is defined as the data stream input sampling rate.
[0053] It is worth mentioning that, in one embodiment, the execution module 400 is also used to read the adjusted cached data queue in the cache module 200 and execute the corresponding action of the adjusted cached data queue when it is detected that the real-time cache occupancy rate in the cache module 200 reaches the preset startup threshold for the first time. For example, the preset startup threshold can be 50%, that is, when the data proportion in the cache module 200 reaches 50% for the first time, the execution module 400 starts the execution action, thereby improving the stability of data output.
[0054] Based on the above hardware structure but not limited to the above hardware structure, the present application provides a first embodiment of a data cache processing method, referring to Figure 2 , Figure 2 This is a flow chart of the first embodiment of the data cache processing method of the present application.
[0055] In this embodiment, the method includes:
[0056] Step S101 : obtaining the real-time cache occupancy rate of the cache module 200 .
[0057] In this embodiment, the execution subject of the data cache processing method is the data flow adjustment module 300 in the electronic device. The real-time cache occupancy rate is the percentage of the cached data queue in the cache module 200 to the total storage space of the cache module 200. Among them, the size of the total storage space of the cache module 200 can be expressed as n, that is, the total number of data that can be stored in the cache module 200. The size of the current cached data queue of the cache module 200 can be expressed as q, and the ratio of the two d=q / n is the real-time cache occupancy rate.
[0058] Specifically, as an option of this embodiment, the cache module 200 can detect in real time the percentage of the current cached data queue in the total storage space of the cache module 200, that is, the real-time cache occupancy rate. The data flow adjustment module 300 can read in real time the real-time cache occupancy rate of the cache module 200. Alternatively, as another option of this embodiment, the data flow adjustment module 300 can monitor in real time the percentage of the current cached data queue in the cache module 200 in the total storage space of the cache module 200, thereby obtaining the real-time cache occupancy rate.
[0059] Step S102: determine whether the real-time cache occupancy rate is within a preset threshold range.
[0060] The preset threshold range includes a preset occupancy upper limit value and a preset occupancy lower limit value, wherein the preset occupancy upper limit value is a preset low data proportion value, that is, after the execution module 400 starts to read the cached data queue in the cache module 200, the highest occupancy rate of the cached data queue in the cache module 200 in the total cache space, wherein the preset occupancy upper limit value can be expressed as dH. It can be understood that the preset occupancy lower limit value is a preset high data proportion value, that is, after the execution module 400 starts to read the cached data queue in the cache module 200, the highest occupancy rate of the cached data queue in the cache module 200 in the total cache space, wherein the preset occupancy lower limit value can be expressed as dL. It can be understood that dH and dL can be specifically set and updated by the user, such as the preset occupancy lower limit value dL can be determined as 20%, and the preset occupancy upper limit value dH can be determined as 80%.
[0061] After obtaining the real-time cache occupancy d of the cache module 200, the data flow adjustment module 300 may compare the real-time cache occupancy d with the preset occupancy upper limit dH and the preset occupancy lower limit dL respectively to determine whether d is between dH and dL. If d is between dH and dL, the real-time cache occupancy is within the preset threshold range.
[0062] Specifically, the data flow adjustment module 300 determines whether dL<d<dH holds. If dL<d<dH holds, the real-time cache occupancy is within a preset threshold range, and the data flow adjustment module 300 does not need to perform an adjustment action.
[0063] Step S103: If it is not within the preset threshold range, the cached data queue of the cache module 200 is adjusted so that the real-time cache occupancy rate of the cache module 200 after adjustment is within the preset threshold range.
[0064] The data flow adjustment module 300 determines whether dL<d<dH is established. If dL<d<dH is not established, that is, dL≥d, or d≥dH, the real-time cache occupancy of the cache module 200 is not within the preset threshold range. At this time, the data flow adjustment module 300 can adjust the cached data queue of the cache module 200, such as deleting data to reduce the real-time cache occupancy, or performing a data addition operation to increase the real-time cache occupancy, so that the real-time cache occupancy of the cache module 200 after adjustment is within the preset threshold range, so that the amount of cached data of the cache module 200 can be controlled within the preset threshold range, so that the total storage space size of the cache module 200 can be set to be smaller, thereby reducing the delay.
[0065] It is easy to understand that, affected by factors such as the hardware design of the electronic device system and the consistency differences of the crystal oscillator, the data stream output sampling rate cannot be completely equal to the data stream input sampling rate, resulting in the cache module 200 data being prone to batch loss or abnormal mutation when executing actions for a long time. In this embodiment, the number of data in the buffer module is always maintained within a certain range by dynamically adding data points, deleting data points and other adjustment operations on the cached data queue in the cache module 200, thereby preventing the cache module 200 from being lost in batches and becoming empty, or data overflow and abnormal mutation.
[0066] It is worth mentioning that in this embodiment, the data flow adjustment module 300 can delete part of the data in batches, such as the newly added data or the initial data, or selectively delete some of the data points therein. Alternatively, in this embodiment, the data flow adjustment module 300 can also add part of the data or add data points to fill the storage space of the cache module 200 to improve the real-time cache occupancy rate.
[0067] Based on the first embodiment of the method described above, a first embodiment of the data cache processing method of the present invention is proposed. Figure 3 , Figure 3 FIG. 4 is a flow chart of a second embodiment of a data cache processing method according to the present invention.
[0068] In this embodiment, the method includes:
[0069] Step S201: Obtain the real-time cache occupancy rate of the cache module 200.
[0070] Step S202: Determine whether the real-time cache occupancy rate is within a preset threshold range.
[0071] Among them, steps S201 to S202 can refer to the above steps S101 to S102, which will not be repeated here.
[0072] Step S203: If the value is not within the preset threshold range, the cached data queue is divided into at least one sub-data queue according to a preset adjustment step; the sub-data queue includes at least one data point.
[0073] The cached data queue is composed of data points in sequence. The preset adjustment step is the length of the pre-set sub-data queue, which can be expressed as m. Specifically, when the data flow adjustment module 300 determines that dL<d<dH is not established, the cached data queue is divided into at least one sub-data queue with a length not exceeding m, that is, each sub-data queue includes at most m data points.
[0074] Step S204: for any of the sub-data queues, determine a target data point from at least one of the data points.
[0075] Step S205: adjust the target data point so that the real-time cache occupancy rate of the cache module 200 after adjustment is within the preset threshold range.
[0076] In this embodiment, the data flow adjustment module 300 only adjusts the target data points, that is, in the entire cached data queue, the data flow adjustment module 300 only adjusts a part of the data points therein to reduce the impact on the original data flow.
[0077] It is worth mentioning that the target data point can be any one in the sub-data queue, that is, the data flow adjustment module 300 randomly deletes a data point every m data points.
[0078] Alternatively, the target data point may also be a data point selected from the sub-data queue according to an algorithm. In one specific implementation, step S204 is specifically as follows:
[0079] For any of the sub-data queues, a target data point having the smallest absolute value of the modulus of the data point is selected from at least one of the data points.
[0080] Specifically, after the data flow adjustment module 300 divides the current cached data queue into multiple sub-data queues according to the preset adjustment step length m, it takes the absolute value of the modulus of all data points in each m data point, and sorts the absolute values of the m moduli using the bubble sort method, so as to determine the target data point corresponding to the minimum value. The absolute value of the modulus of the data point represents the size of the data point, and the smaller the absolute value, the closer it is to 0.
[0081] In this embodiment, the data flow adjustment module 300 selects the point closest to 0 among the m points as the target adjustment point for adjustment operation, so that after operations such as deletion or copying of the target data point, the impact on the original data flow will be minimized, so that the valid data flow in the action data flow of the electronic device's system input is basically not affected.
[0082] In a specific embodiment, the execution module 400 is a linear motor, and the action data stream cached in the cache module 200 is the target acceleration waveform data a(t). Therefore, the target acceleration waveform data a(t) can be divided into multiple segments of m data points, and for each group of m data points, the data point with the acceleration amplitude closest to 0 is used as the target data point, so that the effective data stream in the target acceleration waveform data a(t) is basically not affected.
[0083] As an embodiment, step S205 includes:
[0084] If the real-time cache occupancy rate is greater than or equal to a preset occupancy rate upper limit value within the preset threshold range, the target data point is deleted.
[0085] Specifically, when the data flow adjustment module 300 determines that d≥dH, the cached data queue in the cache module 200 is increasing and is about to reach the boundary of full data, and there is a risk of data overflow. At this time, the target data point can be deleted to perform point deletion adjustment. Therefore, this embodiment maintains the number of data in the buffer within a certain range by dynamically deleting data points, eliminates the phenomenon of data overflow in the buffer area, and further solves the problem of data batch loss in the long response process.
[0086] In addition, in this embodiment, the target data point to be deleted is the data point closest to 0, which has the smallest impact on the valid data of the action data stream, thereby ensuring that the execution module 400 can stably and relatively closely output the action feedback required by the system.
[0087] As an embodiment, step S205 includes:
[0088] If the real-time cache occupancy rate is less than or equal to the preset occupancy rate lower limit value of the preset threshold range, the target data point is copied to obtain a copied data point, and the copied data point is cached.
[0089] When the data flow adjustment module 300 determines that d≤dL, the cached data queue in the cache module 200 is decreasing and is about to reach the boundary of empty data, and there is a risk of abnormal data mutation. At this time, the target data point can be added to perform point increase adjustment. Specifically, the data flow adjustment module 300 can copy the target data point and cache the copied data point obtained after the copy, thereby updating the action data stream.
[0090] This embodiment maintains the number of data in the buffer module within a certain range by dynamically adding data points, thereby preventing the phenomenon of empty data in the cache module 200 and further solving the problem of abnormal data mutations during a long response process.
[0091] In addition, in this embodiment, the target data point copied and added is the data point closest to 0, which has the smallest impact on the valid data of the action data stream, thereby ensuring that the execution module 400 can stably, relatively closely, and without mutation output the action feedback required by the system.
[0092] As an option of this embodiment, step S205 specifically includes:
[0093] The duplicate data point is inserted and cached at a position adjacent to the target data point in the cached data queue.
[0094] In this embodiment, in order to further reduce the impact on valid data in the action data stream, the data stream adjustment module 300 can insert the duplicate data point as an adjacent data point of the target data point into the cache module 200 without changing the existing data.
[0095] If the execution module 400 is a linear motor, the action data stream cached in the cache module 200 is the target acceleration waveform data a(t). After the target acceleration waveform data a(t) is divided into multiple segments of m data points, for each group of m data points a(t) 1 , ..., a(t) m , the data point a(t) whose acceleration amplitude is closest to 0 3 As the target data point, and then copy it to get the copied data point a(t)' 3 , so that the adjusted set of data points includes m+1 data points: a(t) 1 、a(t) 2 、a(t) 3 , a(t)' 3 ……、a(t) m It can be understood that the duplicate data point can be inserted before or after the target data point, and this embodiment does not limit this.
[0096] It can be seen that in this embodiment, due to a(t) 3 , a(t)' 3 Both are close to 0, and the effective data stream in the target acceleration waveform data a(t) is basically not affected.
[0097] For ease of understanding, a specific implementation is shown below:
[0098] In an electronic device, the total length n of the total storage buffer area in the cache module 200 is 480 data points, the preset occupancy rate lower limit dL=20%, the preset occupancy rate upper limit dH=80%, the data stream output sampling rate Fs1 is constant 48kHz, and the data stream input sampling rate Fs2 fluctuates between 47kHz-49kHz. During the execution of the action data stream, the real-time cache occupancy of the cache module 200 is as follows: Figure 5 As shown, the real-time cache occupancy rate of the cache module 200 in a certain 0.2S is as follows: Figure 6 It can be seen that when the input and output sampling rates are inconsistent and the sampling rates fluctuate, under the setting of a smaller data buffer area, the real-time buffer occupancy rate d of the buffer module 200 in this embodiment is strictly limited to the set range of 20%-80%, indicating that this embodiment can effectively solve the problem of long-term playback data buffer overflow or empty caused by inconsistent sampling rates, and the buffer area can be set very small, which has the advantage of small playback delay.
[0099] In addition, based on the same inventive concept, refer to Figure 4 The present invention also provides a data cache processing device, comprising:
[0100] An occupancy acquisition module, used to acquire the real-time cache occupancy of the cache module 200;
[0101] An occupancy rate determination module is used to determine whether the real-time cache occupancy rate is within a preset threshold range;
[0102] The data adjustment module is used to adjust the cached data queue of the cache module 200 if it is not within the preset threshold range, so that the real-time cache occupancy rate of the cache module 200 after adjustment is within the preset threshold range.
[0103] In one embodiment, the data adjustment module includes:
[0104] A division unit, configured to divide the cached data queue into at least one sub-data queue according to a preset adjustment step; the sub-data queue includes at least one data point;
[0105] a target determination unit, configured to determine a target data point from at least one of the data points for any of the sub-data queues;
[0106] The data adjustment unit is used to adjust the target data point so that the real-time cache occupancy rate of the cache module 200 after adjustment is within the preset threshold range.
[0107] In one embodiment, the target determination module is further used to select, for any of the sub-data queues, a target data point having the smallest absolute value of the modulus of the data point from at least one of the data points.
[0108] In one embodiment, the data adjustment module is further configured to delete the target data point if the real-time cache occupancy rate is greater than or equal to a preset occupancy rate upper limit value of the preset threshold range.
[0109] In one embodiment, the data adjustment module is further used to copy the target data point to obtain a copied data point and cache the copied data point if the real-time cache occupancy is less than or equal to a preset occupancy lower limit value of the preset threshold range.
[0110] In one embodiment, the data adjustment module is further configured to insert and cache the duplicate data point at a position adjacent to the target data point in the sub-data queue.
[0111] In addition, an embodiment of the present invention further proposes a computer storage medium, on which a data cache processing program is stored, and when the data cache processing program is executed by a processor, the steps of the data cache processing method as described above are implemented. Therefore, it will not be described in detail here. In addition, the description of the beneficial effects of adopting the same method will not be described in detail. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application. As an example, program instructions can be deployed to be executed on one computing device, or on multiple computing devices located at one location, or on multiple computing devices distributed at multiple locations and interconnected by a communication network.
[0112] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the above-mentioned program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the above-mentioned storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0113] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A data cache processing method, characterized in that: include: Get the real-time cache occupancy rate of the cache module; Determining whether the real-time cache occupancy rate is within a preset threshold range; If it is not within the preset threshold range, adjusting the cached data queue of the cache module so that the real-time cache occupancy rate of the cache module after adjustment is within the preset threshold range; The step of adjusting the cached data queue of the cache module so that the real-time cache occupancy rate of the cache module after adjustment is within the preset threshold range includes: According to a preset adjustment step, the cached data queue is divided into at least one sub-data queue; the sub-data queue includes at least one data point; Adjusting the cached data queue, including deleting the data points in batches or selectively; For any sub-data queue in the cached data queue, select a target data point with the smallest absolute value of the modulus of the data point from at least one of the data points; If the real-time cache occupancy rate is greater than or equal to the preset occupancy rate upper limit value of the preset threshold range, deleting the target data point; If the real-time cache occupancy rate is less than or equal to the preset occupancy rate lower limit value of the preset threshold range, the target data point is copied to obtain a copied data point, and the copied data point is cached.
2. The data cache processing method according to claim 1, characterized in that: The caching the replicated data point includes: The duplicate data point is inserted and cached at a position adjacent to the target data point in the cached data queue.
3. A data cache processing device, characterized in that: include: An occupancy acquisition module is used to obtain the real-time cache occupancy of the cache module; An occupancy rate determination module is used to determine whether the real-time cache occupancy rate is within a preset threshold range; a data adjustment module, configured to adjust the cached data queue of the cache module if the data queue is not within the preset threshold range, so that the real-time cache occupancy rate of the cache module after adjustment is within the preset threshold range; The data adjustment module comprises: A partitioning unit, configured to partition the cached data queue into at least one sub-data queue according to a preset adjustment step; the sub-data queue includes at least one data point; and adjust the cached data queue, including deleting the data points in batches or selectively; a target determination unit, configured to select, for any of the sub-data queues in the cached data queue, a target data point having a minimum absolute value of a modulus of the data point from at least one of the data points; a data adjustment unit, configured to delete the target data point if the real-time cache occupancy rate is greater than or equal to a preset occupancy rate upper limit value of the preset threshold range; The data adjustment unit is further configured to copy the target data point to obtain a copy data point and cache the copy data point if the real-time cache occupancy is less than or equal to a preset occupancy lower limit value of the preset threshold range.
4. An electronic device, characterized in that: include: A data stream processing module, used for outputting action data stream; A cache module, the cache module is used to receive and cache the action data stream to obtain a cached data queue; a data flow adjustment module, configured to obtain a real-time cache occupancy rate of a cache module; determine whether the real-time cache occupancy rate is within a preset threshold range; if not within the preset threshold range, adjust the cached data queue of the cache module so that the real-time cache occupancy rate of the cache module after adjustment is within the preset threshold range; An execution module, used for reading the adjusted cached data queue in the cache module and executing an action corresponding to the adjusted cached data queue; The data flow adjustment module is specifically used to divide the cached data queue into at least one sub-data queue according to a preset adjustment step; the sub-data queue includes at least one data point; adjust the cached data queue, including deleting the data points in batches or selectively; for any of the sub-data queues in the cached data queue, filter out a target data point with the smallest absolute value of the modulus of the data point from at least one of the data points; If the real-time cache occupancy rate is greater than or equal to the preset occupancy rate upper limit value of the preset threshold range, deleting the target data point; If the real-time cache occupancy rate is less than or equal to the preset occupancy rate lower limit value of the preset threshold range, the target data point is copied to obtain a copied data point, and the copied data point is cached.
5. The electronic device according to claim 4, characterized in that: The execution module is further configured to read the adjusted cached data queue in the cache module and execute corresponding actions of the adjusted cached data queue when it is detected that the real-time cache occupancy in the cache module reaches a preset startup threshold for the first time.
6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a data cache processing program, and when the data cache processing program is executed by the processor, the data cache processing method according to claim 1 or 2 is implemented.
Citation Information
Patent Citations
Message storage method and apparatus
CN109257320A
Audio equipment, howling processing method thereof and computer storage medium
CN110213694A
Data transmission method between host and USB device and corres ponding USB device
CN1776656A