CN115757495A - Cache data processing method and device, computer equipment and storage medium - Google Patents

Cache data processing method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN115757495A
CN115757495A CN202211453643.2A CN202211453643A CN115757495A CN 115757495 A CN115757495 A CN 115757495A CN 202211453643 A CN202211453643 A CN 202211453643A CN 115757495 A CN115757495 A CN 115757495A
Authority
CN
China
Prior art keywords
target
information
cache data
interface
preset
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211453643.2A
Other languages
Chinese (zh)
Inventor
庄志辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Property and Casualty Insurance Company of China Ltd
Original Assignee
Ping An Property and Casualty Insurance Company of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Property and Casualty Insurance Company of China Ltd filed Critical Ping An Property and Casualty Insurance Company of China Ltd
Priority to CN202211453643.2A priority Critical patent/CN115757495A/en
Publication of CN115757495A publication Critical patent/CN115757495A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application belongs to the field of big data, and relates to a cache data processing method, which comprises the following steps: judging whether an information change request triggered by a management user through a target interface is received; wherein, the information change request carries change identification information; if so, analyzing the information change request, and extracting change identification information from the information change request; acquiring a preset database table; inquiring the database table based on the change identification information, and inquiring a target key value corresponding to the change identification information from the database table; and based on a preset message queue, deleting the original cache data corresponding to the target key value in the redis database. The application also provides a cache data processing device, computer equipment and a storage medium. In addition, the present application also relates to a block chain technique, and error positioning information can be stored in the block chain. The method and the device effectively improve the processing efficiency and the processing intelligence of the deletion processing of the cache data in the redis database.

Description

Cache data processing method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of big data technologies, and in particular, to a method and an apparatus for processing cache data, a computer device, and a storage medium.
Background
In the using process of some insurance APPs, user information is important information for business flow of a user in the insurance APPs, and user information changes of the same user, including role changes, and permission changes can influence application display and business flow of an interface. At present, the long cache based on the user can enable the user to have certain benefits in APP experience, the user service data can be identified through user codes in an interface request and additional attributes of the user identification, a judgment link related to user information in service flow circulation can pass through quickly, and the user service data can be returned quickly when being acquired. However, the long cache of the user means that the accuracy of the cache needs to be maintained all the time, so that the dynamic cache refreshing requires that the user cache needs to be refreshed when the user changes the information, but changing the user information is really a non-high-frequency operation belonging to the user, because of the complexity of the cache, the existing method can only simply traverse and delete all relevant caches of the user ID to reload the cache for the user, but this processing mode has a case that the deleted cache is not targeted, the key list of the whole redis database needs to be traversed to delete the relevant caches, and the processing efficiency of cache deletion is low.
Disclosure of Invention
An object of the embodiments of the present application is to provide a cache data processing method, an apparatus, a computer device, and a storage medium, so as to solve the technical problems that an existing cache deletion processing manner has a situation that a deleted cache is not targeted, a key list of a whole redis database needs to be traversed to delete a relevant cache, and the processing efficiency of cache deletion is low.
In order to solve the foregoing technical problem, an embodiment of the present application provides a cache data processing method, which adopts the following technical solutions:
judging whether an information change request triggered by a management user through a target interface is received; the information change request carries change identification information, and the change identification information comprises a target user identification and a target change identification trigger type;
if so, analyzing the information change request, and extracting the change identification information from the information change request;
acquiring a preset database table;
querying the database table based on the change identification information, and querying a target key value corresponding to the change identification information from the database table;
and based on a preset message queue, deleting the original cache data corresponding to the target key value in the redis database.
Further, the step of deleting, based on a preset message queue, the original cache data corresponding to the target key value in the redis database specifically includes:
calling the preset message queue;
sending the target key value to the message queue so as to record a data deletion task corresponding to the original cache data in the message queue;
acquiring the target key value from the message queue;
and deleting the original cache data obtained by querying from the redis database based on the target key value.
Further, after the step of deleting the original cache data corresponding to the target key value in the redis database based on the preset message queue, the method further includes:
acquiring interface information of the target interface; the interface information comprises an interface name and interface parameters;
calling an interface method corresponding to the interface information;
operating the interface method to generate corresponding target cache data;
and storing the target cache data in the redis database to finish the updating process of the original cache data.
Further, after the step of calling the interface method corresponding to the interface information, the method further includes:
acquiring method parameters of the interface method and acquiring a method name of the interface method;
acquiring multiple preset storage modes;
determining a target storage mode from all the storage modes;
and storing the interface information based on the target storage mode.
Further, the step of storing the target cache data in the redis database specifically includes:
acquiring preset caching time; and the number of the first and second groups,
acquiring preset expiration time;
storing the target cache data into the redis database based on the cache time and the expiration time.
Further, before the step of determining whether an information change request triggered by a user through a target interface is received, the method further includes:
judging whether a data query request triggered by a user through the target interface is received;
if so, operating a preset method corresponding to the target interface to obtain corresponding operation result data; adding a user-defined annotation into the preset method corresponding to the target interface;
returning the operation result data to a terminal corresponding to the user; and the number of the first and second groups,
in the running process of the preset method, calling a preset thread to acquire the specified information corresponding to the custom annotation; the specified information comprises a user identifier, a change identifier trigger type and a key value in the operation result data;
generating a corresponding data record based on the specified information;
storing the data record in the database table.
Further, before the step of operating the preset method corresponding to the target interface to obtain the corresponding operation result data, the method further includes:
obtaining the self-defined annotation;
adding the custom annotation into the preset method corresponding to the target interface;
acquiring a preset identification bit;
and adding the identification bit into the attribute of the custom annotation.
In order to solve the foregoing technical problem, an embodiment of the present application further provides a cache data processing apparatus, which adopts the following technical solutions:
the first judgment module is used for judging whether an information change request triggered by a management user through a target interface is received or not; the information change request carries change identification information, and the change identification information comprises a target user identification and a target change identification trigger type;
the extraction module is used for analyzing the information change request and extracting the change identification information from the information change request if the information change request is true;
the first acquisition module is used for acquiring a preset database table;
the query module is used for querying the database table based on the change identification information and querying a target key value corresponding to the change identification information from the database table;
and the processing module is used for deleting the original cache data corresponding to the target key value in the redis database based on a preset message queue.
In order to solve the above technical problem, an embodiment of the present application further provides a computer device, which adopts the following technical solutions:
judging whether an information change request triggered by a management user through a target interface is received; the information change request carries change identification information, and the change identification information comprises a target user identification and a target change identification trigger type;
if so, analyzing the information change request, and extracting the change identification information from the information change request;
acquiring a preset database table;
querying the database table based on the change identification information, and querying a target key value corresponding to the change identification information from the database table;
and based on a preset message queue, deleting the original cache data corresponding to the target key value in the redis database.
In order to solve the above technical problem, an embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solutions:
judging whether an information change request triggered by a management user through a target interface is received; the information change request carries change identification information, and the change identification information comprises a target user identification and a target change identification trigger type;
if so, analyzing the information change request, and extracting the change identification information from the information change request;
acquiring a preset database table;
querying the database table based on the change identification information, and querying a target key value corresponding to the change identification information from the database table;
and based on a preset message queue, deleting the original cache data corresponding to the target key value in the redis database.
Compared with the prior art, the embodiment of the application mainly has the following beneficial effects:
when an information change request triggered by a management user through a target interface is received, the information change request is firstly analyzed, change identification information is extracted from the information change request, then a preset database table is obtained, the database table is subsequently inquired based on the change identification information, a target key value corresponding to the change identification information is inquired from the database table, and finally, original cache data corresponding to the target key value in a redis database is deleted based on a preset message queue. According to the method and the device, the target key value corresponding to the cache data to be deleted can be quickly inquired out from the database table based on the change identification information, and then the original cache data corresponding to the target key value in the redis database can be quickly and accurately deleted based on the message queue, so that the key value list traversing the whole redis database is not needed to delete the relevant cache, and the processing efficiency and the processing intelligence of cache data deletion are effectively improved.
Drawings
In order to more clearly illustrate the solution of the present application, the drawings needed for describing the embodiments of the present application will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present application, and that other drawings can be obtained by those skilled in the art without inventive effort.
FIG. 1 is an exemplary system architecture diagram in which the present application may be applied;
FIG. 2 is a flow diagram of one embodiment of a method of cached data processing according to the present application;
FIG. 3 is a block diagram of one embodiment of a cache data processing apparatus according to the present application;
FIG. 4 is a schematic block diagram of one embodiment of a computer device according to the present application.
Detailed Description
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "including" and "having," and any variations thereof, in the description and claims of this application and the description of the above figures are intended to cover non-exclusive inclusions. The terms "first," "second," and the like in the description and claims of this application or in the above-described drawings are used for distinguishing between different objects and not for describing a particular order.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. Various communication client applications, such as a web browser application, a shopping application, a search application, an instant messaging tool, a mailbox client, social platform software, etc., may be installed on the terminal devices 101, 102, 103.
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture experts Group Audio Layer III, mpeg compression standard Audio Layer 3), MP4 players (Moving Picture experts Group Audio Layer IV, mpeg compression standard Audio Layer 4), laptop portable computers, desktop computers, and the like.
The server 105 may be a server providing various services, such as a background server providing support for pages displayed on the terminal devices 101, 102, 103.
It should be noted that, the cache data processing method provided in the embodiment of the present application is generally executed by a server/terminal device, and accordingly, the cache data processing apparatus is generally disposed in the server/terminal device.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continuing reference to FIG. 2, a flow diagram of one embodiment of a method of caching data according to the present application is shown. The cache data processing method comprises the following steps:
step S201, judging whether an information change request triggered by a management user through a target interface is received; the information change request carries change identification information, and the change identification information comprises a target user identification and a target change identification trigger type.
In this embodiment, the electronic device (for example, the server/terminal device shown in fig. 1) on which the cache data processing method operates may obtain the information change request through a wired connection manner or a wireless connection manner. It should be noted that the wireless connection means may include, but is not limited to, a 3G/4G/5G connection, a WiFi connection, a bluetooth connection, a WiMAX connection, a Zigbee connection, an UWB (ultra wideband) connection, and other wireless connection means now known or developed in the future. The electronic device comprises an operation management background system, and the information change request can be a service change request triggered when a management user executes user information change operation in the operation management background system. The target user identifier may be represented by a UserId, the target change identifier trigger type may include an update operation or a delete operation, the update operation may be represented by an update, and the delete operation may be represented by a delete. The management user is a worker related to the maintenance work of the operation management background system.
And step S202, if so, analyzing the information change request and extracting the change identification information from the information change request.
In this embodiment, the information change request is analyzed to obtain an analysis result, and the required change identification information can be extracted from the analysis result.
Step S203, a preset database table is obtained.
In this embodiment, the database table is pre-created according to actual service usage requirements, and stores a plurality of pieces of preset change identification information and key values corresponding to the preset change identification information one to one.
Step S204, the database table is inquired based on the change identification information, and a target key value corresponding to the change identification information is inquired from the database table.
In this embodiment, after the change identification information is obtained, the change identification information and all preset change identification information stored in the database table may be subjected to information matching processing based on the parallel comparison instruction, and then the target change identification information that is the same as the change identification information is determined from all preset change identification information. And then, the key value corresponding to the target change identification information is inquired from the database table to obtain the target key value.
Step S205, based on a preset message queue, delete the original cache data corresponding to the target key value in the redis database.
In this embodiment, the Message Queue (MQ) is a kind of data structure of "first-in first-out" in the basic data structure. The redis database is an open source log-type and Key-Value database which is written by using ANSIC language, supports network, can be based on memory and can also be persistent, and provides API of multiple languages. Some commonly used data are cached in a Redis database by introducing a Redis server, so that the data loading efficiency is well improved, and the reading and writing times of the database are reduced. The cache data in the redis database and the Key Value have a one-to-one correspondence relationship, the Key Value is equivalent to Key, and the Value corresponding to Key is equivalent to the cache data. In addition, after the original cache data corresponding to the target key value in the redis database is deleted based on the preset message queue, the latest service data can be acquired when the user performs interface access after the user changes the related information. In addition, in the above specific implementation process of deleting the original cache data corresponding to the target key value in the redis database based on the preset message queue, the present application will further describe details in the following specific embodiments, and will not be set forth herein more.
When an information change request triggered by a management user through a target interface is received, the information change request is firstly analyzed, change identification information is extracted from the information change request, then a preset database table is obtained, the database table is subsequently inquired based on the change identification information, a target key value corresponding to the change identification information is inquired from the database table, and finally, original cache data corresponding to the target key value in a redis database is deleted based on a preset message queue. According to the method and the device, the target key value corresponding to the cache data to be deleted can be quickly inquired out from the database table based on the change identification information, and then the original cache data corresponding to the target key value in the redis database can be quickly and accurately deleted based on the message queue, so that the key value list traversing the whole redis database is not needed to delete the relevant cache, and the processing efficiency and the processing intelligence of cache data deletion are effectively improved.
In some alternative implementations, step S205 includes the following steps:
and calling the preset message queue.
In this embodiment, the message queue is used to record a data deleting task corresponding to the original cache data, that is, writing the target key value into the message queue may be regarded as generating and recording a data deleting task to be executed.
And sending the target key value to the message queue so as to record a data deletion task corresponding to the original cache data in the message queue.
In this embodiment, a processing mechanism for a confirmation character is established between the electronic device and the message queue, and when the message queue detects that a newly written key value is in the queue, the confirmation character is sent to the electronic device. After the target key value is written into the message queue by the electronic equipment, whether a confirmation character sent by the message queue is received or not is detected within a preset time length. When the electronic equipment receives the confirmation characters sent by the message queue within the preset time length, the target key value is judged to be successfully written into the message queue; and when the electronic equipment does not receive the confirmation characters sent by the message queue within the preset time length, the target key value needs to be written into the message queue again. In addition, the value of the preset duration is not specifically limited, and may be set according to an actual use requirement, for example, may be set to 1 second. The successful writing of the target key value into the message queue can be ensured through the above operations.
And acquiring the target key value from the message queue.
In this embodiment, the message queue may send the target key value written therein to the electronic device according to a preset sending rule. The preset rule may be that a key value acquisition instruction sent by the electronic device is received, or a target key value is sent to the electronic device every time a preset interval duration elapses.
And deleting the original cache data which is obtained by inquiring the redis database based on the target key value.
In this embodiment, when the electronic device obtains a target key value in the message queue, it is determined that a data deletion task corresponding to the target key value needs to be executed currently, specifically, a specified key value matching the target key value is first queried from a redis database, and corresponding cache data, that is, the original cache data, is obtained based on the query of the specified key value. And after the original cache data is inquired, deleting the original cache data from a redis database.
According to the method and the device, the original cache data corresponding to the target key value in the redis database is deleted by using the preset message queue, so that the efficiency and the intelligence of the deletion processing of the cache data are improved.
In some optional implementation manners of this embodiment, after step S205, the electronic device may further perform the following steps:
acquiring interface information of the target interface; the interface information comprises an interface name and interface parameters.
And calling an interface method corresponding to the interface information.
In this embodiment, the interface method is specifically a service method generated by pre-writing according to actual service usage requirements.
And operating the interface method to generate corresponding target cache data.
In this embodiment, a corresponding method operation result is obtained by operating the interface method, and the method operation result may be used as the target cache data.
And storing the target cache data in the redis database to finish the updating process of the original cache data.
In this embodiment, after the original cache data in the redis database is deleted, the target cache data is stored in the redis database, so that the resetting of the cache data can be completed.
According to the method and the device, after the original cache data corresponding to the target key value in the redis database is deleted by using the message queue, the corresponding target cache data is generated by acquiring the interface information of the target interface, calling and operating the interface method corresponding to the interface information, and then the target cache data is stored in the redis database to reset the cache data, so that the effect of updating the cache is achieved, and the processing intelligence of updating the cache data is improved.
In some optional implementation manners, after the step of calling the interface method corresponding to the interface information, the electronic device may further perform the following steps:
and acquiring method parameters of the interface method and acquiring a method name of the interface method.
And acquiring multiple preset storage modes.
In this embodiment, the storage manner may be set according to actual usage requirements, and may include, for example, database storage, block chain storage, and the like.
And determining a target storage mode from all the storage modes.
In this embodiment, the determination method of the target storage method is not particularly limited, and may be determined according to the personal preference of the user, for example.
And storing the interface information based on the target storage mode.
According to the method and the device for determining the interface corresponding to the interface information, the method parameters and the method names of the interface methods are obtained, the target storage mode can be determined from the multiple storage modes, and then the interface information is stored based on the target storage mode, so that the storage intelligence of the method information of the interface methods is improved, and the use experience of a user is improved.
In some optional implementations, the step of storing the target cache data in the redis database includes the steps of:
and acquiring preset caching time. And the number of the first and second groups,
in this embodiment, the cache time refers to a storage time for storing the target cache data in the redis database. The value of the cache time is not particularly limited, and may be set according to actual service use requirements.
And acquiring a preset expiration time.
In this embodiment, the expiration time refers to an expiration time of a key value corresponding to the target cache data. An expiration time can be set for the key value of the cache data in the redis database by using the EXPIRE command, so that the effect of 'automatically deleting the key value at the end point' is achieved, the key value with low use frequency is prevented from existing for a long time, the memory resource is occupied, and the expiration time of the cache data is controlled. In which each key value with an expiration time set may be stored in a separate dictionary in the redis database, and the dictionary may be periodically traversed to delete expired key values. In addition to timed traversal, a "lazy policy" may be used to delete expired key values. The lazy policy refers to that when a client accesses any one key value, the expiration time of the key value is checked, and if the key value is expired, the key value is immediately deleted. The value of the expiration time is not specifically limited, and may be set according to actual service use requirements.
Storing the target cache data into the redis database based on the cache time and the expiration time.
According to the method and the device, the target cache data are stored into the redis database based on the cache time and the expiration time by acquiring the preset cache time and the expiration time, and the condition that a key value with low use frequency exists for a long time is avoided by controlling the invalidation time of the cache data, so that memory resources are occupied, the cache intelligence of the cache data is improved, and the use experience of a user is improved.
In some optional implementation manners of this embodiment, before step S201, the electronic device may further perform the following steps:
and judging whether a data query request triggered by the user through the target interface is received.
In this embodiment, the data query request refers to a request for querying required service data, which is triggered when a user accesses a service scenario in the APP.
If so, operating a preset method corresponding to the target interface to obtain corresponding operation result data; and adding a custom annotation into the preset method corresponding to the target interface.
In this embodiment, the preset method is specifically a service method generated by pre-writing according to actual service usage requirements. The user-defined annotation is a pre-written annotation used for acquiring a user identifier corresponding to the target interface when the target interface generates the cache, the generated cache data and the change identifier trigger type in the execution process of the preset method.
And returning the operation result data to the terminal corresponding to the user. And the number of the first and second groups,
in this embodiment, the operation result data is service data that needs to be queried by the user and corresponds to the data query request.
In the running process of the preset method, calling a preset thread to acquire the specified information corresponding to the custom annotation; the specified information comprises a user identifier, a change identifier trigger type and a key value in the operation result data.
In this embodiment, the preset thread is a thread created in advance in the electronic device to implement asynchronous processing. After the return of the operation result data is completed, the operation result data needs to be cached in a redis database so as to perform subsequent data query.
And generating a corresponding data record based on the specified information.
In this embodiment, the data record at least includes the specific information. The arrangement information of various information included in the above-mentioned designated information is not limited, and may be set according to actual use requirements, for example, the arrangement mode of the key value in the user identifier, the change identifier trigger type, and the operation result data may be adopted.
Storing the data record in the database table.
In this embodiment, by storing the data record in the database table, it is beneficial to quickly acquire the required data record by querying the database table in the following.
When a user accesses a target interface, the data records generated by the target interface and corresponding to the cache data are recorded by adding the custom notes on the interface level of the target interface, and the data records are stored in the database table, so that the target data records corresponding to the information change request triggered by the management user through the target interface can be quickly acquired by inquiring the database table subsequently, and then the target key value corresponding to the change identification information is inquired from the database table based on the target data records, and the acquisition efficiency of the target key value is improved.
In some optional implementation manners of this embodiment, before the step of operating the preset method corresponding to the target interface to obtain the corresponding operation result data, the electronic device may further perform the following steps:
and acquiring the self-defined annotation.
In this embodiment, the custom annotation is a pre-written annotation for acquiring a user identifier, generated cache data, and a type of change identifier trigger corresponding to the target interface when generating the cache in the execution process of the preset method.
And adding the custom annotation into the preset method corresponding to the target interface.
And acquiring a preset identification bit.
In this embodiment, the identification bits are information that is written in advance and is used to identify key values in the operation result data generated by the preset method, which need to be recorded in a table (database table), and that relates to a user information change and needs to read corresponding key values from the database table based on change identification information to perform deletion operation.
And adding the identification bit into the attribute of the custom annotation.
According to the method and the device, the user-defined annotation is added into the preset method corresponding to the target interface, and the identification bit is added into the attribute of the user-defined annotation, so that the adjustment processing of the target interface is completed, and the data record corresponding to the cache data generated by the target interface can be intelligently recorded when an information change request triggered by a user through the target interface is received.
It is emphasized that, in order to further ensure the privacy and security of the change identifier, the change identifier may also be stored in a node of a block chain.
The block chain referred by the application is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
The embodiment of the application can acquire and process related data based on an artificial intelligence technology. Among them, artificial Intelligence (AI) is a theory, method, technique and application system that simulates, extends and expands human Intelligence using a digital computer or a machine controlled by a digital computer, senses the environment, acquires knowledge and uses the knowledge to obtain the best result.
The artificial intelligence infrastructure generally includes technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a robot technology, a biological recognition technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and the like.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware associated with computer readable instructions, which can be stored in a computer readable storage medium, and when executed, the processes of the embodiments of the methods described above can be included. The storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a Random Access Memory (RAM).
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
With further reference to fig. 3, as an implementation of the method shown in fig. 2, the present application provides an embodiment of a cache data processing apparatus, where the embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 2, and the apparatus may be specifically applied to various electronic devices.
As shown in fig. 3, the cache data processing apparatus 300 according to the embodiment includes: a first judgment module 301, an extraction module 302, a first acquisition module 303, a query module 304 and a processing module 305. Wherein:
a first judging module 301, configured to judge whether an information change request triggered by a management user through a target interface is received; the information change request carries change identification information, and the change identification information comprises a target user identification and a target change identification trigger type;
an extracting module 302, configured to, if yes, parse the information change request, and extract the change identification information from the information change request;
a first obtaining module 303, configured to obtain a preset database table;
a query module 304, configured to query the database table based on the change identification information, and query a target key value corresponding to the change identification information from the database table;
the processing module 305 is configured to delete the original cache data corresponding to the target key value in the redis database based on a preset message queue.
In this embodiment, the operations executed by the modules or units respectively correspond to the steps of the cache data processing method in the foregoing embodiment one to one, and are not described herein again.
In some optional implementations of this embodiment, the processing module 305 includes:
the calling submodule is used for calling the preset message queue;
the sending submodule is used for sending the target key value to the message queue so as to record a data deleting task corresponding to the original cache data in the message queue;
the first obtaining submodule is used for obtaining the target key value from the message queue;
and the processing submodule is used for deleting the original cache data which is obtained by inquiring from the redis database based on the target key value.
In this embodiment, the operations executed by the modules or units respectively correspond to the steps of the cache data processing method in the foregoing embodiment one to one, and are not described herein again.
In some optional implementation manners of this embodiment, the cache data processing apparatus further includes:
the second acquisition module is used for acquiring the interface information of the target interface; the interface information comprises an interface name and interface parameters;
the calling module is used for calling an interface method corresponding to the interface information;
the first generation module is used for operating the interface method to generate corresponding target cache data;
and the first storage module is used for storing the target cache data in the redis database so as to finish the updating processing of the original cache data.
In this embodiment, the operations that the modules or units are respectively configured to execute correspond to the steps of the cache data processing method in the foregoing embodiment one to one, and are not described herein again.
In some optional implementation manners of this embodiment, the cache data processing apparatus further includes:
the third acquisition module is used for acquiring the method parameters of the interface method and acquiring the method name of the interface method;
the fourth acquisition module is used for acquiring multiple preset storage modes;
the determining module is used for determining a target storage mode from all the storage modes;
and the second storage module is used for storing the interface information based on the target storage mode.
In this embodiment, the operations executed by the modules or units respectively correspond to the steps of the cache data processing method in the foregoing embodiment one to one, and are not described herein again.
In some optional implementations of this embodiment, the first storage module includes:
the second obtaining submodule is used for obtaining preset caching time; and the number of the first and second groups,
the third obtaining submodule is used for obtaining preset expiration time;
and the storage submodule is used for storing the target cache data into the redis database based on the cache time and the expiration time.
In this embodiment, the operations executed by the modules or units respectively correspond to the steps of the cache data processing method in the foregoing embodiment one to one, and are not described herein again.
In some optional implementations of this embodiment, the cache data processing apparatus further includes:
the second judgment module is used for judging whether a data query request triggered by a user through the target interface is received or not;
the operation module is used for operating a preset method corresponding to the target interface to obtain corresponding operation result data if the preset method is the same as the target interface; adding a user-defined annotation into the preset method corresponding to the target interface;
the return module is used for returning the operation result data to the terminal corresponding to the user; and the number of the first and second groups,
a fifth obtaining module, configured to invoke a preset thread to obtain specified information corresponding to the custom annotation in an operation process of the preset method; the specified information comprises a user identifier, a change identifier trigger type and a key value in the operation result data;
the second generation module is used for generating corresponding data records based on the specified information;
and the third storage module is used for storing the data records in the database table.
In this embodiment, the operations executed by the modules or units respectively correspond to the steps of the cache data processing method in the foregoing embodiment one to one, and are not described herein again.
In some optional implementation manners of this embodiment, the cache data processing apparatus further includes:
a sixth obtaining module, configured to obtain the custom annotation;
the first adding module is used for adding the custom annotation into the preset method corresponding to the target interface;
a seventh obtaining module, configured to obtain a preset identification bit;
and the second adding and acquiring module is used for adding the identification bit into the attribute of the custom annotation.
In this embodiment, the operations executed by the modules or units respectively correspond to the steps of the cache data processing method in the foregoing embodiment one to one, and are not described herein again.
In order to solve the technical problem, an embodiment of the present application further provides a computer device. Referring to fig. 4, fig. 4 is a block diagram of a basic structure of a computer device according to the present embodiment.
The computer device 4 comprises a memory 41, a processor 42, a network interface 43 communicatively connected to each other via a system bus. It is noted that only computer device 4 having components 41-43 is shown, but it is understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead. As will be understood by those skilled in the art, the computer device is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and the hardware includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The computer equipment can carry out man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch panel or voice control equipment and the like.
The memory 41 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 41 may be an internal storage unit of the computer device 4, such as a hard disk or a memory of the computer device 4. In other embodiments, the memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the computer device 4. Of course, the memory 41 may also include both internal and external storage devices of the computer device 4. In this embodiment, the memory 41 is generally used for storing an operating system installed in the computer device 4 and various types of application software, such as computer readable instructions of a cache data processing method. Further, the memory 41 may also be used to temporarily store various types of data that have been output or are to be output.
The processor 42 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 42 is typically used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is configured to execute the computer readable instructions stored in the memory 41 or process data, for example, execute the computer readable instructions of the cache data processing method.
The network interface 43 may comprise a wireless network interface or a wired network interface, and the network interface 43 is generally used for establishing communication connection between the computer device 4 and other electronic devices.
Compared with the prior art, the embodiment of the application mainly has the following beneficial effects:
in the embodiment of the application, when an information change request triggered by a management user through a target interface is received, the information change request is firstly analyzed, change identification information is extracted from the information change request, then a preset database table is obtained, the database table is subsequently inquired based on the change identification information, a target key value corresponding to the change identification information is inquired from the database table, and finally, original cache data corresponding to the target key value in a redis database is deleted based on a preset message queue. According to the method and the device, the target key value corresponding to the cache data to be deleted can be quickly inquired out from the database table based on the change identification information, and then the original cache data corresponding to the target key value in the redis database can be quickly and accurately deleted based on the message queue, so that the key value list traversing the whole redis database is not required to delete the related cache, and the processing efficiency and the processing intelligence of cache data deletion are effectively improved.
The present application further provides another embodiment, which is to provide a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, which can be executed by at least one processor, so as to cause the at least one processor to execute the steps of the cache data processing method as described above.
Compared with the prior art, the embodiment of the application mainly has the following beneficial effects:
in the embodiment of the application, when an information change request triggered by a management user through a target interface is received, the information change request is firstly analyzed, change identification information is extracted from the information change request, then a preset database table is obtained, the database table is subsequently inquired based on the change identification information, a target key value corresponding to the change identification information is inquired from the database table, and finally, original cache data corresponding to the target key value in a redis database is deleted based on a preset message queue. According to the method and the device, the target key value corresponding to the cache data to be deleted can be quickly inquired out from the database table based on the change identification information, and then the original cache data corresponding to the target key value in the redis database can be quickly and accurately deleted based on the message queue, so that the key value list traversing the whole redis database is not needed to delete the relevant cache, and the processing efficiency and the processing intelligence of cache data deletion are effectively improved.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application or portions thereof that contribute to the prior art may be embodied in the form of a software product, where the computer software product is stored in a storage medium (such as a ROM/RAM, a magnetic disk, and an optical disk), and includes several instructions for enabling a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
It should be understood that the above-described embodiments are merely exemplary of some, and not all, embodiments of the present application, and that the drawings illustrate preferred embodiments of the present application without limiting the scope of the claims appended hereto. This application is capable of embodiments in many different forms and is provided for the purpose of enabling a thorough understanding of the disclosure of the application. Although the present application has been described in detail with reference to the foregoing embodiments, it will be apparent to one skilled in the art that the present application may be practiced without modification or with equivalents of some of the features described in the foregoing embodiments. All equivalent structures made by using the contents of the specification and the drawings of the present application are directly or indirectly applied to other related technical fields and are within the protection scope of the present application.

Claims (10)

1. A cache data processing method is characterized by comprising the following steps:
judging whether an information change request triggered by a management user through a target interface is received; the information change request carries change identification information, and the change identification information comprises a target user identification and a target change identification trigger type;
if so, analyzing the information change request, and extracting the change identification information from the information change request;
acquiring a preset database table;
querying the database table based on the change identification information, and querying a target key value corresponding to the change identification information from the database table;
and based on a preset message queue, deleting the original cache data corresponding to the target key value in the redis database.
2. The method for processing cache data according to claim 1, wherein the step of deleting, based on a preset message queue, original cache data corresponding to the target key value in an r ed is database specifically includes:
calling the preset message queue;
sending the target key value to the message queue so as to record a data deletion task corresponding to the original cache data in the message queue;
acquiring the target key value from the message queue;
and deleting the original cache data which is obtained by inquiring the r ed is database based on the target key value.
3. The method for processing cache data according to claim 1, wherein after the step of performing deletion processing on original cache data corresponding to the target key value in the redis database based on a preset message queue, the method further comprises:
acquiring interface information of the target interface; the interface information comprises an interface name and interface parameters;
calling an interface method corresponding to the interface information;
operating the interface method to generate corresponding target cache data;
and storing the target cache data in the redis database to finish the updating process of the original cache data.
4. The method for processing cached data according to claim 3, further comprising, after the step of calling the interface method corresponding to the interface information:
acquiring method parameters of the interface method and acquiring a method name of the interface method;
acquiring multiple preset storage modes;
determining a target storage mode from all the storage modes;
and storing the interface information based on the target storage mode.
5. The method for processing cache data according to claim 3, wherein the step of storing the target cache data in the r ed is database specifically comprises:
acquiring preset caching time; and the number of the first and second groups,
acquiring preset expiration time;
storing the target cache data into the redis database based on the cache time and the expiration time.
6. The method for processing cache data according to claim 1, wherein before the step of determining whether an information change request triggered by a user through a target interface is received, the method further comprises:
judging whether a data query request triggered by a user through the target interface is received;
if so, operating a preset method corresponding to the target interface to obtain corresponding operation result data; adding a user-defined annotation into the preset method corresponding to the target interface;
returning the operation result data to a terminal corresponding to the user; and the number of the first and second groups,
in the running process of the preset method, calling a preset thread to acquire the specified information corresponding to the custom annotation; the specified information comprises a user identifier, a change identifier trigger type and a key value in the operation result data;
generating a corresponding data record based on the specified information;
storing the data record in the database table.
7. The method for processing cache data according to claim 6, wherein before the step of operating the preset method corresponding to the target interface to obtain the corresponding operation result data, the method further comprises:
obtaining the self-defined annotation;
adding the custom annotation into the preset method corresponding to the target interface;
acquiring a preset identification bit;
and adding the identification bit into the attribute of the custom annotation.
8. A cache data processing apparatus, comprising:
the first judgment module is used for judging whether an information change request triggered by a management user through a target interface is received or not; the information change request carries change identification information, and the change identification information comprises a target user identification and a target change identification trigger type;
the extraction module is used for analyzing the information change request and extracting the change identification information from the information change request if the information change request is true;
the first acquisition module is used for acquiring a preset database table;
the query module is used for querying the database table based on the change identification information and querying a target key value corresponding to the change identification information from the database table;
and the processing module is used for deleting the original cache data corresponding to the target key value in the redis database based on a preset message queue.
9. A computer device comprising a memory having computer readable instructions stored therein and a processor which when executed implements the steps of the method of caching data for processing as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, having computer-readable instructions stored thereon, which, when executed by a processor, implement the steps of the method of caching data for processing according to any one of claims 1 to 7.
CN202211453643.2A 2022-11-21 2022-11-21 Cache data processing method and device, computer equipment and storage medium Pending CN115757495A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211453643.2A CN115757495A (en) 2022-11-21 2022-11-21 Cache data processing method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211453643.2A CN115757495A (en) 2022-11-21 2022-11-21 Cache data processing method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115757495A true CN115757495A (en) 2023-03-07

Family

ID=85333199

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211453643.2A Pending CN115757495A (en) 2022-11-21 2022-11-21 Cache data processing method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115757495A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116009949A (en) * 2023-03-28 2023-04-25 税友软件集团股份有限公司 Numerical value acquisition method, device, equipment and storage medium
CN116186059A (en) * 2023-04-24 2023-05-30 民航成都信息技术有限公司 Flight data updating method, system, electronic device and storage medium
CN116521745A (en) * 2023-07-04 2023-08-01 北京长亭科技有限公司 Caching method and device
CN117194549A (en) * 2023-11-07 2023-12-08 上海柯林布瑞信息技术有限公司 Data transmission method and device based on task data configuration
CN117193670A (en) * 2023-11-06 2023-12-08 之江实验室 Method and device for clearing cache, storage medium and electronic equipment

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116009949A (en) * 2023-03-28 2023-04-25 税友软件集团股份有限公司 Numerical value acquisition method, device, equipment and storage medium
CN116009949B (en) * 2023-03-28 2023-08-29 税友软件集团股份有限公司 Numerical value acquisition method, device, equipment and storage medium
CN116186059A (en) * 2023-04-24 2023-05-30 民航成都信息技术有限公司 Flight data updating method, system, electronic device and storage medium
CN116186059B (en) * 2023-04-24 2023-06-30 民航成都信息技术有限公司 Flight data updating method, system, electronic device and storage medium
CN116521745A (en) * 2023-07-04 2023-08-01 北京长亭科技有限公司 Caching method and device
CN117193670A (en) * 2023-11-06 2023-12-08 之江实验室 Method and device for clearing cache, storage medium and electronic equipment
CN117193670B (en) * 2023-11-06 2024-01-30 之江实验室 Method and device for clearing cache, storage medium and electronic equipment
CN117194549A (en) * 2023-11-07 2023-12-08 上海柯林布瑞信息技术有限公司 Data transmission method and device based on task data configuration
CN117194549B (en) * 2023-11-07 2024-01-26 上海柯林布瑞信息技术有限公司 Data transmission method and device based on task data configuration

Similar Documents

Publication Publication Date Title
CN115757495A (en) Cache data processing method and device, computer equipment and storage medium
CN112491602B (en) Behavior data monitoring method and device, computer equipment and medium
CN112162965A (en) Log data processing method and device, computer equipment and storage medium
CN110808868B (en) Test data acquisition method and device, computer equipment and storage medium
CN104657435A (en) Storage management method for application data and network management system
CN113254445A (en) Real-time data storage method and device, computer equipment and storage medium
CN115455058A (en) Cache data processing method and device, computer equipment and storage medium
CN115757492A (en) Hotspot data processing method and device, computer equipment and storage medium
CN112328486A (en) Interface automation test method and device, computer equipment and storage medium
CN114996675A (en) Data query method and device, computer equipment and storage medium
CN115712422A (en) Form page generation method and device, computer equipment and storage medium
CN112436943B (en) Request deduplication method, device, equipment and storage medium based on big data
CN107657155B (en) Method and device for authenticating user operation authority
CN112363814A (en) Task scheduling method and device, computer equipment and storage medium
CN112860662A (en) Data blood relationship establishing method and device, computer equipment and storage medium
CN112416934A (en) hive table incremental data synchronization method and device, computer equipment and storage medium
CN114968725A (en) Task dependency relationship correction method and device, computer equipment and storage medium
CN114186976A (en) Workflow transfer method and device, computer equipment and storage medium
CN115544558A (en) Sensitive information detection method and device, computer equipment and storage medium
CN114510908A (en) Data export method and device, computer equipment and storage medium
CN114626352A (en) Report automatic generation method and device, computer equipment and storage medium
CN111585897B (en) Request route management method, system, computer system and readable storage medium
CN114637672A (en) Automatic data testing method and device, computer equipment and storage medium
CN114143308A (en) File uploading information processing method and device, computer equipment and storage medium
CN112559914A (en) Index data display method and device

Legal Events

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