CN112015758B - Product code-fetching method, device, computer equipment and storage medium - Google Patents

Product code-fetching method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN112015758B
CN112015758B CN202010880728.3A CN202010880728A CN112015758B CN 112015758 B CN112015758 B CN 112015758B CN 202010880728 A CN202010880728 A CN 202010880728A CN 112015758 B CN112015758 B CN 112015758B
Authority
CN
China
Prior art keywords
code
taking
product
preset
hit rate
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.)
Active
Application number
CN202010880728.3A
Other languages
Chinese (zh)
Other versions
CN112015758A (en
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 CN202010880728.3A priority Critical patent/CN112015758B/en
Publication of CN112015758A publication Critical patent/CN112015758A/en
Application granted granted Critical
Publication of CN112015758B publication Critical patent/CN112015758B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • G06F16/24534Query rewriting; Transformation
    • G06F16/24539Query rewriting; Transformation using cached or materialised query results
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application relates to a product code fetching method, a device, computer equipment and a storage medium based on data caching. The method comprises the following steps: and acquiring a target code-taking product corresponding to the received code-taking request and the hit rate of the target code-taking product stored in the first-level cache. When the hit rate is determined to meet the preset requirement, the corresponding product number and the preset splicing prefix are obtained, and the code-taking identification corresponding to the target code-taking product is obtained through splicing. And determining a secondary cache corresponding to the target code-taking product according to the code-taking identification, and extracting the exchange code corresponding to the target code-taking product from the secondary cache when the secondary cache is determined to be non-empty. By adopting the method, the exchange code corresponding to the target code-taking product can be directly obtained from the secondary cache in the memory according to the code-taking request, the data is not required to be relied on for real-time obtaining, the burden of a database is reduced, and the efficiency of obtaining the exchange code is improved. In addition, the invention also relates to a block chain technology, and hit rate and exchange code attribute information of the code-taking product can be stored in the block chain.

Description

Product code-fetching method, device, computer equipment and storage medium
Technical Field
The present disclosure relates to the field of internet technologies, and in particular, to a method, an apparatus, a computer device, and a storage medium for code fetching of a product.
Background
With the rapid development and popularization of the internet and the coming of big data age, more and more users realize the popularization of business or products to be sold through the internet. Aiming at the operation popularization requirements of the products to be sold, the method can be realized by setting corresponding exchange codes for different products, the user can exchange the corresponding products in a network form according to the held exchange codes, and the products can be physical or virtual products. The exchanging code is a number composed of a group of letters and numbers, suppliers corresponding to different products are different, and the exchanging code corresponding to each product is obtained by setting the respective suppliers according to own rules.
In actual operation promotion activities, the exchange codes corresponding to each product are stored in the database, and in a promotion time period of a product to be sold, a plurality of users usually initiate requests to access and acquire the same exchange code corresponding to the product at the same time, so that the exchange code is accessed very frequently in a very short time, thereby causing the problem of database hot block, seriously affecting the performance of the database, and causing lower efficiency of providing the corresponding exchange code for the users.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a product code capturing method, apparatus, computer device, and storage medium that can improve the efficiency of capturing a redemption code.
A method of code extraction for a product, the method comprising:
receiving a code receiving request, and acquiring a target code-taking product corresponding to the code-taking request;
acquiring the hit rate of the target code-taking product stored in the first-level cache;
when the hit rate of the target code-taking product in the first-level cache meets the preset requirement, acquiring the product number of the target code-taking product and a preset splicing prefix for identifying a second-level cache;
splicing the product number and the preset splicing prefix to obtain a code-taking identifier corresponding to the target code-taking product;
determining a secondary cache corresponding to the target code-taking product according to the code-taking identifier;
and when the secondary cache is determined to be not empty, extracting the exchange code corresponding to the target code-taking product from the secondary cache.
In one embodiment, determining the manner in which the hit rate of the target code-taking product in the first-level cache meets the preset requirement includes:
when the hit rate of the target code-taking product is determined to be larger than a preset hit rate threshold, determining that the hit rate of the target code-taking product meets the preset requirement.
In one embodiment, the method for updating the hit rate of each code-fetching product in the first-level cache comprises the following steps:
acquiring a product number of a target code-taking product carried by the code-taking request;
when the target code-taking product exists in the primary cache according to the product number, increasing the hit rate of the target code-taking product by a preset value, and subtracting the preset value from the hit rate of other code-taking products.
In one embodiment, the secondary cache stores the exchange code attribute information corresponding to each code-taking product; the method further comprises the steps of:
acquiring hit rates of all code-fetching products in the primary cache in a preset updating time period;
acquiring a preset hit rate threshold;
comparing the hit rate of each code-taking product with the preset hit rate threshold;
when the code-taking product with the hit rate smaller than the preset hit rate threshold exists, deleting the code-taking product and the corresponding hit rate from the first-level cache, and deleting the exchange code attribute information of the code-taking product from the second-level cache.
In one embodiment, after the hit rates of all the code-fetching products in the first-level cache are obtained in the preset updating period, the method further includes:
Recording the current code taking time of each code taking product;
acquiring the last code-taking time of each code-taking product;
calculating the interval time between the current code-taking time and the last code-taking time;
acquiring a preset code-fetching time threshold;
comparing the interval time with the preset code-fetching time threshold;
when the code-taking product with the interval time larger than the preset code-taking time threshold value is determined to exist, deleting the code-taking product and the corresponding hit rate from the first-level cache, and deleting the exchange code attribute information of the code-taking product from the second-level cache.
In one embodiment, the method further comprises:
acquiring the creation time of the secondary cache;
and determining the creation time of the secondary cache as the calculation basis of the protection time of the secondary cache.
In one embodiment, before determining that the hit rate of the target code-taking product meets the preset requirement when determining that the hit rate of the target code-taking product is greater than a preset hit rate threshold, the method further includes:
obtaining a preset hit rate of a preset number of standard code-taking products;
according to the value of each preset hit rate, arranging the preset hit rates of a preset number to obtain a preset hit rate queue;
Acquiring the minimum hit rate in the preset hit rate queue, and determining the minimum hit rate as a preset hit rate threshold;
and comparing the preset hit rate threshold with the hit rate of the target code-taking product.
A product code-fetching device, said device comprising:
the target code-taking product acquisition module is used for receiving a code-taking request and acquiring a target code-taking product corresponding to the code-taking request;
the hit rate acquisition module is used for acquiring the hit rate of the target code-taking product in the first-level cache;
the first acquisition module is used for acquiring a product number of the target code-taking product and a preset splicing prefix for identifying a secondary cache when the hit rate of the target code-taking product in the primary cache is determined to meet the preset requirement;
the code-taking identifier generation module is used for splicing the product number and the preset splicing prefix to obtain a code-taking identifier corresponding to the target code-taking product;
the secondary cache determining module is used for determining a secondary cache corresponding to the target code-taking product according to the code-taking identification;
and the redemption code extraction module is used for extracting the redemption code corresponding to the target code-taking product from the secondary cache when the secondary cache is determined to be not empty.
A computer device comprising a memory storing a computer program and a processor which when executing the computer program performs the steps of:
receiving a code receiving request, and acquiring a target code-taking product corresponding to the code-taking request;
acquiring the hit rate of the target code-taking product stored in the first-level cache;
when the hit rate of the target code-taking product in the first-level cache meets the preset requirement, acquiring the product number of the target code-taking product and a preset splicing prefix for identifying a second-level cache;
splicing the product number and the preset splicing prefix to obtain a code-taking identifier corresponding to the target code-taking product;
determining a secondary cache corresponding to the target code-taking product according to the code-taking identifier;
and when the secondary cache is determined to be not empty, extracting the exchange code corresponding to the target code-taking product from the secondary cache.
A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
receiving a code receiving request, and acquiring a target code-taking product corresponding to the code-taking request;
Acquiring the hit rate of the target code-taking product stored in the first-level cache;
when the hit rate of the target code-taking product in the first-level cache meets the preset requirement, acquiring the product number of the target code-taking product and a preset splicing prefix for identifying a second-level cache;
splicing the product number and the preset splicing prefix to obtain a code-taking identifier corresponding to the target code-taking product;
determining a secondary cache corresponding to the target code-taking product according to the code-taking identifier;
and when the secondary cache is determined to be not empty, extracting the exchange code corresponding to the target code-taking product from the secondary cache.
According to the method, the device, the computer equipment and the storage medium for fetching the code, the target code fetching product corresponding to the code fetching request is obtained by receiving the code fetching request, and the hit rate of the target code fetching product stored in the first-level cache is obtained. When the hit rate of the target code-taking product in the first-level cache meets the preset requirement, the product number of the target code-taking product and the preset splicing prefix used for identifying the second-level cache are obtained, and the product number and the preset splicing prefix are spliced to obtain the code-taking identifier corresponding to the target code-taking product. And further determining a secondary cache corresponding to the target code-taking product according to the code-taking identification, and extracting the exchange code corresponding to the target code-taking product from the secondary cache when the secondary cache is determined to be non-empty. The progressive acquisition of the redemption code is realized through the set first-level cache and second-level cache, so that the redemption code corresponding to the target redemption code product can be directly acquired from the second-level cache in the memory according to the redemption code acquisition request without real-time acquisition depending on data, the burden of a database is reduced, the occurrence probability of database hot block problems is reduced, and the redemption code acquisition efficiency is further improved.
Drawings
FIG. 1 is a diagram of an application environment for a product code fetch method in one embodiment;
FIG. 2 is a flow chart of a method for code extraction of a product according to one embodiment;
FIG. 3 is a schematic diagram of a correspondence between a first level cache and a second level cache in one embodiment;
FIG. 4 is a flow chart of a method for coding a product according to another embodiment;
FIG. 5 is a block diagram of a product code fetch apparatus according to one embodiment;
fig. 6 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
The code fetching method of the product can be applied to an application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a network. The server 104 receives a code fetch request initiated by a user based on the terminal 102, and obtains a target code fetch product corresponding to the code fetch request, thereby obtaining the hit rate of the target code fetch product stored in the first-level cache. When the hit rate of the target code-taking product in the first-level cache meets the preset requirement, the product number of the target code-taking product and the preset splicing prefix used for identifying the second-level cache are obtained, and the product number and the preset splicing prefix are spliced to obtain the code-taking identifier corresponding to the target code-taking product. And further determining a secondary cache corresponding to the target code-taking product according to the code-taking identification, and when the secondary cache is determined to be non-empty, extracting the exchange code corresponding to the target code-taking product from the secondary cache, and feeding back the exchange code to the terminal 102. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smartphones, tablet computers, and portable wearable devices, and the server 104 may be implemented by a stand-alone server or a server cluster composed of a plurality of servers.
In one embodiment, as shown in fig. 2, a method for code fetching of a product is provided, and the method is applied to the server in fig. 1 for illustration, and includes the following steps:
step S202, a code fetch request is received, and a target code fetch product corresponding to the code fetch request is obtained.
Specifically, when a code-taking request initiated by a user based on a terminal is received, the code-taking request is analyzed, a product number carried by the code-taking request is obtained, and a corresponding target code-taking product is determined according to the product number. The product numbers and the target code-taking products have one-to-one correspondence, and the unique target code-taking products can be determined according to the product numbers.
In one embodiment, before receiving the code fetch request and acquiring the target code fetch product corresponding to the code fetch request, the method further includes:
and acquiring each code-taking product and the corresponding hit rate determined based on the service requirement, and storing each code-taking product and the corresponding hit rate into a first-level cache. And further acquiring the conversion code attribute information corresponding to each code-taking product, and storing the conversion code attribute information into a secondary cache.
The corresponding products and the set rules of hit rates corresponding to the products are different according to the operation popularization requirements of different clients, and the hit rates obtained by different clients according to different product settings are inconsistent. The hit rate indicates the number of times the code-taking product is requested to exchange the code, the exchange code is a number composed of a group of letters and numbers, suppliers corresponding to different products are different, and the exchange code corresponding to each product is set by each supplier according to own rules.
Similarly, the initial hit rate of different products is preset by the customer to which the products belong, and if each code-taking product is requested to exchange codes once, the hit rate is increased by 1, and the hit rate of other code-taking products in the first-level cache is decreased by 1.
Specifically, in this embodiment, as shown in fig. 3, fig. 3 provides a correspondence between a first-level cache and a second-level cache, and referring to fig. 3, the first-level cache is used for storing a plurality of code-taking products and hit rates corresponding to the code-taking products, which are equivalent to the role of a catalog, and the second-level cache stores exchange code attribute information corresponding to the code-taking products, including exchange codes, exchange code states, exchange code validity periods, exchange code expiration periods, and the like.
Further, only when the target code-taking product and the hit rate thereof which need code-taking are stored in the first-level cache and the corresponding hit rate is determined to meet the preset requirement, the exchange code corresponding to the target code-taking product is further extracted from the second-level cache.
It should be emphasized that, in order to further ensure the hit rate corresponding to the code-taking product and the privacy and security of the exchange code attribute information of the code-taking product, the hit rate corresponding to the code-taking product and the exchange code attribute information of the code-taking product may also be stored in a node of a blockchain.
Step S204, the hit rate of the target code-fetching product stored in the first-level cache is obtained.
Specifically, each code-taking product and the corresponding hit rate are stored in a first-level cache, and in a preset updating time period, the method further comprises the process of updating the hit rate of each code-taking product, and the obtained hit rate of the target code-taking product is the updated current hit rate in the preset updating time period.
Further, the method for updating the hit rate of each code-taking product in the first-level cache comprises the following steps:
acquiring a product number of a target code-taking product carried by a code-taking request; when the target code-taking product exists in the first-level cache according to the product number, the hit rate of the target code-taking product is increased by a preset value, and the hit rate of other code-taking products is subtracted by the preset value.
In this embodiment, the preset value may be 1, that is, when it is determined that the target code-taking product exists in the first-level cache according to the product number, the hit rate of the target code-taking product is increased by 1, and the hit rate of other code-taking products in the first-level cache is subtracted by 1, so as to update the hit rate of each code-taking product in the first-level cache.
In one embodiment, when it is determined that the target code-taking product does not exist in the first-level cache, the target code-taking product is added to the first-level cache, the hit rate of the target code-taking product in the first-level cache is recorded as 1, and the hit rate of other code-taking products in the first-level cache is subtracted by a preset value of 1.
Step S206, when the hit rate of the target code-taking product in the first-level cache is determined to meet the preset requirement, the product number of the target code-taking product and the preset splicing prefix for identifying the second-level cache are obtained.
Specifically, when the hit rate of the target code-taking product in the first-level cache is determined to be larger than a preset hit rate threshold, determining that the hit rate of the target code-taking product in the first-level cache meets a preset requirement. And further, after determining that the hit rate of the target code-taking product in the first-level cache meets the preset requirement, acquiring the product number of the target code-taking product and the preset splicing prefix for identifying the second-level cache.
Step S208, the product number and the preset splicing prefix are spliced to obtain a code-fetching identifier corresponding to the target code-fetching product.
Specifically, since the secondary cache cannot be directly identified according to the product code, a preset splicing prefix which can be used for identifying the secondary cache should be obtained, and the code-fetching identifier corresponding to the target code-fetching product can be obtained by splicing the product number and the preset splicing prefix.
For example, if the product number corresponding to the obtained target CODE-taking product is D12345 and the corresponding preset prefix is spliced to be the pro fit_redeposition_code, the product number and the preset prefix are combined and spliced, and the obtained CODE-taking identifier is D12346-pro fit_redeposition_code. It can be understood that the product numbers of different code-taking products are different, but the preset splicing prefix is used for identifying the secondary cache, and the preset splicing prefix set for different code-taking products can be the same or different.
Step S210, determining a secondary cache corresponding to the target code-taking product according to the code-taking identification.
Specifically, a splicing prefix is preset for identifying the secondary cache, and the secondary cache corresponding to the target code-taking product can be determined by further combining with the product number.
The second-level cache stores the exchange code attribute information corresponding to each code-taking product, including exchange codes, exchange code states, exchange code effective periods, exchange code ineffective periods and the like. The state of the exchange code indicates whether the exchange code is available, the effective period of the exchange code indicates the effective time and the effective duration of the exchange code, the failure period of the exchange code indicates the failure time of the exchange code, and when the failure time is reached, the corresponding exchange is not reusable.
And step S212, when the secondary cache is determined not to be empty, extracting the exchange code corresponding to the target code-taking product from the secondary cache.
Specifically, after the secondary cache of the target code-taking product is obtained, whether the secondary cache is empty is judged. And when the secondary cache is determined to be non-empty, extracting the exchange code corresponding to the target code-taking product from the secondary cache.
In one embodiment, when the secondary cache is determined to be empty, a redemption code corresponding to the target code-taking product is extracted from the database. Meanwhile, the prompt information that the secondary cache of the target code-taking product is empty is pushed to a message queue, and the secondary cache of the target code-taking product is supplemented according to the prompt information, namely, the exchange code state, the exchange code effective period, the exchange code ineffective period and the like corresponding to the target code-taking product are stored in the secondary cache corresponding to the target code-taking product.
In the product code-fetching method, the code-fetching request is received to obtain the target code-fetching product corresponding to the code-fetching request, and the hit rate of the target code-fetching product stored in the first-level cache is obtained. When the hit rate of the target code-taking product in the first-level cache meets the preset requirement, the product number of the target code-taking product and the preset splicing prefix used for identifying the second-level cache are obtained, and the product number and the preset splicing prefix are spliced to obtain the code-taking identifier corresponding to the target code-taking product. And further determining a secondary cache corresponding to the target code-taking product according to the code-taking identification, and extracting the exchange code corresponding to the target code-taking product from the secondary cache when the secondary cache is determined to be non-empty. The progressive acquisition of the redemption code is realized through the set first-level cache and second-level cache, so that the redemption code corresponding to the target redemption code product can be directly acquired from the second-level cache in the memory according to the redemption code acquisition request without real-time acquisition depending on data, the burden of a database is reduced, the occurrence probability of database hot block problems is reduced, and the redemption code acquisition efficiency is further improved.
In one embodiment, the method for determining that the hit rate of the target code-taking product in the first-level cache meets the preset requirement specifically comprises the following steps:
Obtaining a preset hit rate of a preset number of standard code-taking products;
according to the value of each preset hit rate, the preset hit rates of the preset number are arranged to obtain a preset hit rate queue;
acquiring the minimum hit rate in a preset hit rate queue, and determining the minimum hit rate as a preset hit rate threshold;
comparing a preset hit rate threshold with the hit rate of the target code-taking product;
when the hit rate of the target code-taking product is determined to be larger than the preset hit rate threshold, determining that the hit rate of the target code-taking product meets the preset requirement.
Specifically, the preset hit rates of the preset number of standard code-taking products are sequenced according to the value of each preset hit rate, a sequenced preset hit rate queue is obtained, the minimum hit rate is extracted from the preset hit rate queue, and the minimum hit rate is determined to be a preset hit rate threshold. The preset number may be set by a user or determined based on a service requirement, and is randomly determined from the determined value range, in this embodiment, the preset number is 10, and the ordered preset hit rate queue includes 10 preset hit rates, and the minimum value of the 10 preset hit rates is extracted to determine the preset hit rate threshold.
Further, by comparing the preset hit rate threshold with the hit rate of the target code-taking product, when the hit rate of the target code-taking product is determined to be larger than the preset hit rate threshold, the hit rate of the target code-taking product is determined to meet the preset requirement, namely, the product number of the target code-taking product can be further acquired and the preset splicing prefix used for identifying the secondary cache can be indicated, and therefore the secondary cache which can be used for determining the corresponding secondary cache of the target code-taking product is spliced.
In this embodiment, the minimum hit rate is determined from the preset hit rates corresponding to the plurality of standard code-taking products, and the minimum hit rate is determined as a preset hit rate threshold value, so as to compare with the hit rate of the target code-taking product, and when the hit rate of the target code-taking product is determined to be greater than the preset hit rate threshold value, it is indicated that the hit rate of the current target code-taking product meets the preset requirement. The progressive acquisition based on the first-level cache and the second-level cache is realized, the database is not needed, the pressure of the database can be reduced, and the acquisition efficiency of the exchange code is improved.
In one embodiment, a method for code fetching of a product is provided, comprising the steps of:
acquiring hit rates of all code-fetching products in the first-level cache in a preset updating time period;
Acquiring a preset hit rate threshold;
comparing the hit rate of each code-taking product with a preset hit rate threshold;
when the code-taking product with the hit rate smaller than the preset hit rate threshold exists, deleting the code-taking product and the corresponding hit rate from the first-level cache, and deleting the exchange code attribute information of the code-taking product from the second-level cache.
Specifically, the hit rates of all code-taking products in the first-level cache are obtained through a preset updating time period, and compared with a determined preset hit rate threshold value, so that a corresponding comparison result is obtained. When the code-taking product with the hit rate smaller than the preset hit rate threshold value exists in the first-level cache according to the comparison result, deleting the code-taking product and the corresponding hit rate from the first-level cache, and deleting the exchange code information corresponding to the code-taking product from the second-level cache.
The purpose of setting the first-level cache and the second-level cache is to directly obtain the exchange code corresponding to the target code-taking product from the memory without completely depending on a database, so that the problem of database hot blocks is reduced, when the code-taking product with the hit rate smaller than the preset hit rate threshold exists in the first-level cache, the code-taking product is indicated to be requested to be taken fewer times and not belong to the hot code-taking product, the code-taking product is not required to be set to be obtained in a progressive way by combining the first-level cache and the second-level cache, the corresponding exchange code can be directly read from the database, the number of the created caches can be reduced, and the burden on a cluster where the current cache is located, namely a Redis cluster is reduced.
In this embodiment, by comparing the hit rates of all the code-taking products in the first-level cache with the preset hit rate threshold, when there is a code-taking product with a hit rate smaller than the preset hit rate threshold, the code-taking product and the corresponding hit rate are deleted from the first-level cache, and the exchange code attribute information of the code-taking product is deleted from the second-level cache, so as to reduce the number of caches created and the burden of the cluster where the current cache is located.
In one embodiment, a method for code fetching of a product is provided, comprising the steps of:
recording the current code taking time of each code taking product;
acquiring the last code-taking time of each code-taking product;
calculating the interval time between the current code-taking time and the last code-taking time;
acquiring a preset code-fetching time threshold;
comparing the interval time with a preset code-fetching time threshold;
when the code-taking product with the interval time being larger than the preset code-taking time threshold value is determined, deleting the code-taking product and the corresponding hit rate from the first-level cache, and deleting the exchange code attribute information of the code-taking product from the second-level cache.
Specifically, the current code-taking time of each code-taking request of the code-taking product is recorded, the last code-taking time of each corresponding code-taking product is obtained, the time interval between the current code-taking time and the last code-taking time of the code-taking request is calculated, and the interval time is compared with a preset code-taking time threshold value to generate a corresponding comparison result. When the code-taking product with the interval time larger than the preset code-taking time threshold is determined according to the comparison result, deleting the code-taking product and the corresponding hit rate from the first-level cache, and deleting the exchange code attribute information of the code-taking product from the second-level cache.
In the actual operation promotion activities, when there is a holiday in hot section, the code-taking products which are promoted correspondingly are different from the code-taking products which are promoted on normal working days or rest days because the different code-taking products and the corresponding exchange codes are set based on different service demands. After the holiday of the hot festival is finished, the corresponding promotion operation activities of the code-taking product which correspondingly carries out specific promotion are cancelled, and it can be understood that the code-taking product and the corresponding hit rate are deleted from the first-level cache, and the exchange code attribute information of the code-taking product is deleted from the second-level cache by calculating the time interval between the current code-taking time of the request code and the last code-taking time and comparing the time interval with the preset code-taking time threshold value, and when the determined time interval is larger than the preset code-taking time threshold value, the code-taking product is not the hot product promoted in the holiday of the hot festival.
Further, in one embodiment, the method further comprises:
acquiring the creation time of a secondary cache;
and determining the creation time of the secondary cache as the calculation basis of the protection time of the secondary cache.
Specifically, if a secondary cache of a certain code-taking product is built, the condition of eliminating the cache may be satisfied immediately, and in order to avoid the problem that the secondary cache is deleted immediately after being built, and thus frequent operation occupies resources, a protection time needs to be given. And recording the time for creating the secondary cache, wherein the time is used as a basis for calculating the protection time.
In this embodiment, by calculating the interval time between the current code-taking time and the last code-taking time, and comparing the interval time with the preset code-taking time threshold, when it is determined that there is a code-taking product whose interval time is greater than the preset code-taking time threshold, the code-taking product and the corresponding hit rate are deleted from the first-level cache, and the exchange code attribute information of the code-taking product is deleted from the second-level cache, so that the number of caches created and the burden caused to the cluster where the current cache is located can be reduced.
In one embodiment, as shown in fig. 4, a method for coding a product is provided, which specifically includes the following steps:
1) And acquiring each code-taking product and the corresponding hit rate determined based on the service requirement, and storing each code-taking product and the corresponding hit rate into a first-level cache.
The hit rate indicates the number of times the code-taking product is requested to exchange the code, the exchange code is a number composed of a group of letters and numbers, suppliers corresponding to different products are different, and the exchange code corresponding to each product is set by each supplier according to own rules.
2) And acquiring the conversion code attribute information corresponding to each code-taking product, and storing the conversion code attribute information into a secondary cache.
The second-level cache stores the exchange code attribute information corresponding to each code-taking product, including exchange codes, exchange code states, exchange code effective periods, exchange code ineffective periods and the like.
3) Receiving a code receiving request, and obtaining a target code taking product corresponding to the code taking request.
Specifically, when a code-taking request initiated by a user based on a terminal is received, the code-taking request is analyzed, a product number carried by the code-taking request is obtained, and a corresponding target code-taking product is determined according to the product number.
4) And acquiring the hit rate of the target code-taking product stored in the first-level cache.
The method for updating the hit rate of each code-taking product in the first-level cache further comprises the process of updating the hit rate of each code-taking product in a preset updating time period, and comprises the following steps:
acquiring a product number of a target code-taking product carried by a code-taking request; when the target code-taking product exists in the first-level cache according to the product number, the hit rate of the target code-taking product is increased by a preset value, and the hit rate of other code-taking products is subtracted by the preset value.
5) And obtaining the preset hit rate of the preset number of standard code-taking products.
The preset number can be set by a user or determined based on service requirements, and the value range is randomly determined from the determined value range.
6) And according to the value of each preset hit rate, arranging the preset hit rates of the preset number to obtain a preset hit rate queue.
7) And acquiring the minimum hit rate in the preset hit rate queue, and determining the minimum hit rate as a preset hit rate threshold.
8) And comparing the preset hit rate threshold with the hit rate of the target code-taking product.
9) When the hit rate of the target code-taking product is determined to be larger than the preset hit rate threshold, determining that the hit rate of the target code-taking product meets the preset requirement.
10 The product number of the target code-taking product and a preset splicing prefix for identifying the secondary cache are obtained.
11 The product number and a preset splicing prefix are spliced to obtain a code-fetching identifier corresponding to the target code-fetching product.
The second-level cache can not be directly identified according to the product code, a preset splicing prefix which can be used for identifying the second-level cache is also acquired, and the code-fetching identification corresponding to the target code-fetching product can be obtained by splicing the product code and the preset splicing prefix.
12 Determining a secondary cache corresponding to the target code-taking product according to the code-taking identification.
13 When the secondary cache is determined to be not empty, extracting the exchange code corresponding to the target code-taking product from the secondary cache.
The second-level cache stores the exchange code attribute information corresponding to each code-taking product, including exchange codes, exchange code states, exchange code effective periods, exchange code ineffective periods and the like. The status of the redemption code indicates whether the redemption code is available, the effective period of the redemption code indicates the effective time and the effective duration of the redemption code, and the expiration period of the redemption code indicates the expiration time of the redemption code, when the expiration time is reached, the corresponding redemption is not reusable.
14 In a preset updating time period, acquiring the product number of the target code-taking product carried by the code-taking request.
15 When the target code-taking product exists in the first-level cache according to the product number, increasing the hit rate of the target code-taking product by a preset value, and subtracting the preset value from the hit rate of other code-taking products.
Wherein, the preset value can be 1.
16 A preset hit rate threshold is obtained, and the hit rate of each code-taking product is compared with the preset hit rate threshold.
17 When the code-taking product with the hit rate smaller than the preset hit rate threshold exists, deleting the code-taking product and the corresponding hit rate from the first-level cache, and deleting the exchange code attribute information of the code-taking product from the second-level cache.
18 Recording the current code-taking time of each code-taking product and obtaining the last code-taking time of each code-taking product.
19 Calculating the interval time between the current code fetch time and the last code fetch time.
20 A preset code-fetching time threshold value is obtained, and the interval time is compared with the preset code-fetching time threshold value.
21 When the code-taking product with the interval time being larger than the preset code-taking time threshold value is determined, deleting the code-taking product and the corresponding hit rate from the first-level cache, and deleting the exchange code attribute information of the code-taking product from the second-level cache.
In this embodiment, by receiving the code receiving request, a target code-taking product corresponding to the code-taking request is obtained, and the hit rate of the target code-taking product stored in the first-level cache is obtained. When the hit rate of the target code-taking product in the first-level cache meets the preset requirement, the product number of the target code-taking product and the preset splicing prefix used for identifying the second-level cache are obtained, and the product number and the preset splicing prefix are spliced to obtain the code-taking identifier corresponding to the target code-taking product. And further determining a secondary cache corresponding to the target code-taking product according to the code-taking identification, and extracting the exchange code corresponding to the target code-taking product from the secondary cache when the secondary cache is determined to be non-empty. The progressive acquisition of the redemption code is realized through the set first-level cache and second-level cache, so that the redemption code corresponding to the target redemption code product can be directly acquired from the second-level cache in the memory according to the redemption code acquisition request without real-time acquisition depending on data, the burden of a database is reduced, the occurrence probability of database hot block problems is reduced, and the redemption code acquisition efficiency is further improved.
It should be understood that, although the steps in the flowcharts of fig. 2 and 4 are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least a portion of the steps in fig. 2 and 4 may include a plurality of steps or stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the execution of the steps or stages is not necessarily sequential, but may be performed in turn or alternately with at least a portion of the steps or stages in other steps or other steps.
In one embodiment, as shown in fig. 5, there is provided a product code-fetching device, comprising: a target code-taking product acquisition module 502, a hit rate acquisition module 504, a first acquisition module 506, a code-taking identifier generation module 508, a secondary cache determination module 510, and a redemption code extraction module 512, wherein:
the target code-taking product obtaining module 502 is configured to receive the code-taking request and obtain a target code-taking product corresponding to the code-taking request.
The hit rate obtaining module 504 is configured to obtain a hit rate of the target code-taking product in the first-level cache.
The first obtaining module 506 is configured to obtain a product number of the target code-taking product and a preset splicing prefix for identifying the second-level cache when it is determined that the hit rate of the target code-taking product in the first-level cache meets a preset requirement.
The code-fetching identifier generating module 508 is configured to splice the product number and a preset splicing prefix, so as to obtain a code-fetching identifier corresponding to the target code-fetching product.
The secondary cache determining module 510 is configured to determine a secondary cache corresponding to the target code-taking product according to the code-taking identifier.
The redemption code extraction module 512 is configured to extract a redemption code corresponding to the target code-taking product from the secondary cache when the secondary cache is determined to be non-empty.
In the product code-taking device, the code-taking request is received, the target code-taking product corresponding to the code-taking request is obtained, and the hit rate of the target code-taking product stored in the first-level cache is obtained. When the hit rate of the target code-taking product in the first-level cache meets the preset requirement, the product number of the target code-taking product and the preset splicing prefix used for identifying the second-level cache are obtained, and the product number and the preset splicing prefix are spliced to obtain the code-taking identifier corresponding to the target code-taking product. And further determining a secondary cache corresponding to the target code-taking product according to the code-taking identification, and extracting the exchange code corresponding to the target code-taking product from the secondary cache when the secondary cache is determined to be non-empty. The progressive acquisition of the redemption code is realized through the set first-level cache and second-level cache, so that the redemption code corresponding to the target redemption code product can be directly acquired from the second-level cache in the memory according to the redemption code acquisition request without real-time acquisition depending on data, the burden of a database is reduced, the occurrence probability of database hot block problems is reduced, and the redemption code acquisition efficiency is further improved.
In one embodiment, a product code-fetching device is provided, which further includes a deletion module, configured to:
acquiring hit rates of all code-fetching products in the first-level cache in a preset updating time period; acquiring a preset hit rate threshold; comparing the hit rate of each code-taking product with a preset hit rate threshold; when the code-taking product with the hit rate smaller than the preset hit rate threshold exists, deleting the code-taking product and the corresponding hit rate from the first-level cache, and deleting the exchange code attribute information of the code-taking product from the second-level cache.
In this embodiment, by comparing the hit rates of all the code-taking products in the first-level cache with the preset hit rate threshold, when there is a code-taking product with a hit rate smaller than the preset hit rate threshold, the code-taking product and the corresponding hit rate are deleted from the first-level cache, and the exchange code attribute information of the code-taking product is deleted from the second-level cache, so as to reduce the number of caches created and the burden of the cluster where the current cache is located.
In one embodiment, the deletion module is further to:
recording the current code taking time of each code taking product; acquiring the last code-taking time of each code-taking product; calculating the interval time between the current code-taking time and the last code-taking time; acquiring a preset code-fetching time threshold; comparing the interval time with a preset code-fetching time threshold; when the code-taking product with the interval time being larger than the preset code-taking time threshold value is determined, deleting the code-taking product and the corresponding hit rate from the first-level cache, and deleting the exchange code attribute information of the code-taking product from the second-level cache.
In this embodiment, by calculating the interval time between the current code-taking time and the last code-taking time, and comparing the interval time with the preset code-taking time threshold, when it is determined that there is a code-taking product whose interval time is greater than the preset code-taking time threshold, the code-taking product and the corresponding hit rate are deleted from the first-level cache, and the exchange code attribute information of the code-taking product is deleted from the second-level cache, so that the number of caches created and the burden caused to the cluster where the current cache is located can be reduced.
In one embodiment, the first acquisition module is further to:
obtaining a preset hit rate of a preset number of standard code-taking products; according to the value of each preset hit rate, the preset hit rates of the preset number are arranged to obtain a preset hit rate queue; acquiring the minimum hit rate in a preset hit rate queue, and determining the minimum hit rate as a preset hit rate threshold; comparing a preset hit rate threshold with the hit rate of the target code-taking product; when the hit rate of the target code-taking product is determined to be larger than the preset hit rate threshold, determining that the hit rate of the target code-taking product meets the preset requirement.
In this embodiment, the minimum hit rate is determined from the preset hit rates corresponding to the plurality of standard code-taking products, and the minimum hit rate is determined as a preset hit rate threshold value, so as to compare with the hit rate of the target code-taking product, and when the hit rate of the target code-taking product is determined to be greater than the preset hit rate threshold value, it is indicated that the hit rate of the current target code-taking product meets the preset requirement. The progressive acquisition based on the first-level cache and the second-level cache is realized, the database is not needed, the pressure of the database can be reduced, and the acquisition efficiency of the exchange code is improved.
In one embodiment, a product code-fetching device is provided, which further includes an updating module for:
acquiring a product number of a target code-taking product carried by a code-taking request; when the target code-taking product exists in the first-level cache according to the product number, the hit rate of the target code-taking product is increased by a preset value, and the hit rate of other code-taking products is subtracted by the preset value.
For specific limitations of the product code-taking device, reference may be made to the above limitations of the product code-taking method, and no further description is given here. The modules in the product code-fetching device can be realized in whole or in part by software, hardware and a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 6. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer equipment is used for storing code-taking products, hit rates corresponding to the code-taking products and exchange code attribute information corresponding to the code-taking products. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a product code fetch method.
It will be appreciated by those skilled in the art that the structure shown in fig. 6 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided comprising a memory and a processor, the memory having stored therein a computer program, the processor when executing the computer program performing the steps of:
receiving a code receiving request, and acquiring a target code taking product corresponding to the code taking request;
acquiring hit rate of a target code-taking product stored in a first-level cache;
when the hit rate of the target code-taking product in the first-level cache meets the preset requirement, acquiring the product number of the target code-taking product and a preset splicing prefix for identifying the second-level cache;
splicing the product number and a preset splicing prefix to obtain a code-taking identifier corresponding to the target code-taking product;
determining a secondary cache corresponding to the target code-taking product according to the code-taking identification;
and when the secondary cache is determined to be not empty, extracting the exchange code corresponding to the target code-taking product from the secondary cache.
In one embodiment, the processor when executing the computer program further performs the steps of:
when the hit rate of the target code-taking product is determined to be larger than the preset hit rate threshold, determining that the hit rate of the target code-taking product meets the preset requirement.
In one embodiment, the processor when executing the computer program further performs the steps of:
acquiring a product number of a target code-taking product carried by a code-taking request;
when the target code-taking product exists in the first-level cache according to the product number, the hit rate of the target code-taking product is increased by a preset value, and the hit rate of other code-taking products is subtracted by the preset value.
In one embodiment, the processor when executing the computer program further performs the steps of:
acquiring hit rates of all code-fetching products in the first-level cache in a preset updating time period;
acquiring a preset hit rate threshold;
comparing the hit rate of each code-taking product with a preset hit rate threshold;
when the code-taking product with the hit rate smaller than the preset hit rate threshold exists, deleting the code-taking product and the corresponding hit rate from the first-level cache, and deleting the exchange code attribute information of the code-taking product from the second-level cache.
In one embodiment, the processor when executing the computer program further performs the steps of:
Recording the current code taking time of each code taking product;
acquiring the last code-taking time of each code-taking product;
calculating the interval time between the current code-taking time and the last code-taking time;
acquiring a preset code-fetching time threshold;
comparing the interval time with a preset code-fetching time threshold;
when the code-taking product with the interval time being larger than the preset code-taking time threshold value is determined, deleting the code-taking product and the corresponding hit rate from the first-level cache, and deleting the exchange code attribute information of the code-taking product from the second-level cache.
In one embodiment, the processor when executing the computer program further performs the steps of:
acquiring the creation time of a secondary cache;
and determining the creation time of the secondary cache as the calculation basis of the protection time of the secondary cache.
In one embodiment, the processor when executing the computer program further performs the steps of:
obtaining a preset hit rate of a preset number of standard code-taking products;
according to the value of each preset hit rate, the preset hit rates of the preset number are arranged to obtain a preset hit rate queue;
acquiring the minimum hit rate in a preset hit rate queue, and determining the minimum hit rate as a preset hit rate threshold;
And comparing the preset hit rate threshold with the hit rate of the target code-taking product.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
receiving a code receiving request, and acquiring a target code taking product corresponding to the code taking request;
acquiring hit rate of a target code-taking product stored in a first-level cache;
when the hit rate of the target code-taking product in the first-level cache meets the preset requirement, acquiring the product number of the target code-taking product and a preset splicing prefix for identifying the second-level cache;
splicing the product number and a preset splicing prefix to obtain a code-taking identifier corresponding to the target code-taking product;
determining a secondary cache corresponding to the target code-taking product according to the code-taking identification;
and when the secondary cache is determined to be not empty, extracting the exchange code corresponding to the target code-taking product from the secondary cache.
In one embodiment, the computer program when executed by the processor further performs the steps of:
when the hit rate of the target code-taking product is determined to be larger than the preset hit rate threshold, determining that the hit rate of the target code-taking product meets the preset requirement.
In one embodiment, the method for updating the hit rate of each code-taking product in the first-level cache comprises the following steps:
in one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring a product number of a target code-taking product carried by a code-taking request;
when the target code-taking product exists in the first-level cache according to the product number, the hit rate of the target code-taking product is increased by a preset value, and the hit rate of other code-taking products is subtracted by the preset value.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring hit rates of all code-fetching products in the first-level cache in a preset updating time period;
acquiring a preset hit rate threshold;
comparing the hit rate of each code-taking product with a preset hit rate threshold;
when the code-taking product with the hit rate smaller than the preset hit rate threshold exists, deleting the code-taking product and the corresponding hit rate from the first-level cache, and deleting the exchange code attribute information of the code-taking product from the second-level cache.
In one embodiment, the computer program when executed by the processor further performs the steps of:
recording the current code taking time of each code taking product;
Acquiring the last code-taking time of each code-taking product;
calculating the interval time between the current code-taking time and the last code-taking time;
acquiring a preset code-fetching time threshold;
comparing the interval time with a preset code-fetching time threshold;
when the code-taking product with the interval time being larger than the preset code-taking time threshold value is determined, deleting the code-taking product and the corresponding hit rate from the first-level cache, and deleting the exchange code attribute information of the code-taking product from the second-level cache.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring the creation time of a secondary cache;
and determining the creation time of the secondary cache as the calculation basis of the protection time of the secondary cache.
In one embodiment, the computer program when executed by the processor further performs the steps of:
obtaining a preset hit rate of a preset number of standard code-taking products;
according to the value of each preset hit rate, the preset hit rates of the preset number are arranged to obtain a preset hit rate queue;
acquiring the minimum hit rate in a preset hit rate queue, and determining the minimum hit rate as a preset hit rate threshold;
and comparing the preset hit rate threshold with the hit rate of the target code-taking product.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, or the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like.
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The Blockchain (Blockchain), which is essentially a decentralised database, is a string of data blocks that are generated by cryptographic means in association, each data block containing a batch of information of network transactions for verifying the validity of the information (anti-counterfeiting) and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples merely represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the invention. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application is to be determined by the claims appended hereto.

Claims (10)

1. A method for code extraction of a product, the method comprising:
receiving a code receiving request, and acquiring a target code-taking product corresponding to the code-taking request;
acquiring the hit rate of the target code-taking product stored in the first-level cache;
when the hit rate of the target code-taking product in the first-level cache meets the preset requirement, acquiring the product number of the target code-taking product and a preset splicing prefix for identifying a second-level cache;
Splicing the product number and the preset splicing prefix to obtain a code-taking identifier corresponding to the target code-taking product;
determining a secondary cache corresponding to the target code-taking product according to the code-taking identifier;
when the secondary cache is determined to be not empty, extracting a conversion code corresponding to the target code-taking product from the secondary cache;
the method further comprises the steps of:
the method for updating the hit rate of each code-fetching product in the first-level cache comprises the following steps:
acquiring a product number of a target code-taking product carried by the code-taking request; when the target code-taking product exists in the primary cache according to the product number, increasing the hit rate of the target code-taking product by a preset value, and subtracting the preset value from the hit rate of other code-taking products;
the secondary cache stores the exchange code attribute information corresponding to each code-taking product; the method further comprises the steps of:
acquiring hit rates of all code-fetching products in the primary cache in a preset updating time period; acquiring a preset hit rate threshold; comparing the hit rate of each code-taking product with the preset hit rate threshold; when the code-taking product with the hit rate smaller than the preset hit rate threshold exists, deleting the code-taking product and the corresponding hit rate from the first-level cache, and deleting the exchange code attribute information of the code-taking product from the second-level cache.
2. The method of claim 1, wherein determining that the hit rate of the target code-taking product in the first-level cache meets a preset requirement comprises:
when the hit rate of the target code-taking product is determined to be larger than a preset hit rate threshold, determining that the hit rate of the target code-taking product meets the preset requirement.
3. The method of claim 1, further comprising, after the obtaining hit rates of all code fetch products in the primary cache in the preset update period:
recording the current code taking time of each code taking product;
acquiring the last code-taking time of each code-taking product;
calculating the interval time between the current code-taking time and the last code-taking time;
acquiring a preset code-fetching time threshold;
comparing the interval time with the preset code-fetching time threshold;
when the code-taking product with the interval time larger than the preset code-taking time threshold value is determined to exist, deleting the code-taking product and the corresponding hit rate from the first-level cache, and deleting the exchange code attribute information of the code-taking product from the second-level cache.
4. A method according to claim 3, characterized in that the method further comprises:
Acquiring the creation time of the secondary cache;
and determining the creation time of the secondary cache as the calculation basis of the protection time of the secondary cache.
5. The method of claim 2, wherein prior to determining that the hit rate of the target code product meets the preset requirement when the hit rate of the target code product is determined to be greater than a preset hit rate threshold, further comprising:
obtaining a preset hit rate of a preset number of standard code-taking products;
according to the value of each preset hit rate, arranging the preset hit rates of a preset number to obtain a preset hit rate queue;
acquiring the minimum hit rate in the preset hit rate queue, and determining the minimum hit rate as a preset hit rate threshold;
and comparing the preset hit rate threshold with the hit rate of the target code-taking product.
6. A product code-fetching device for implementing the method of any one of claims 1 to 5, characterized in that it comprises:
the target code-taking product acquisition module is used for receiving a code-taking request and acquiring a target code-taking product corresponding to the code-taking request;
the hit rate acquisition module is used for acquiring the hit rate of the target code-taking product in the first-level cache;
The first acquisition module is used for acquiring a product number of the target code-taking product and a preset splicing prefix for identifying a secondary cache when the hit rate of the target code-taking product in the primary cache is determined to meet the preset requirement;
the code-taking identifier generation module is used for splicing the product number and the preset splicing prefix to obtain a code-taking identifier corresponding to the target code-taking product;
the secondary cache determining module is used for determining a secondary cache corresponding to the target code-taking product according to the code-taking identification;
and the redemption code extraction module is used for extracting the redemption code corresponding to the target code-taking product from the secondary cache when the secondary cache is determined to be not empty.
7. The apparatus of claim 6, further comprising a deletion module to:
recording the current code taking time of each code taking product; acquiring the last code-taking time of each code-taking product; calculating the interval time between the current code-taking time and the last code-taking time; acquiring a preset code-fetching time threshold; comparing the interval time with the preset code-fetching time threshold; when the code-taking product with the interval time larger than the preset code-taking time threshold value is determined to exist, deleting the code-taking product and the corresponding hit rate from the first-level cache, and deleting the exchange code attribute information of the code-taking product from the second-level cache.
8. The apparatus of claim 6, wherein the first acquisition module is further configured to:
obtaining a preset hit rate of a preset number of standard code-taking products; according to the value of each preset hit rate, arranging the preset hit rates of a preset number to obtain a preset hit rate queue; acquiring the minimum hit rate in the preset hit rate queue, and determining the minimum hit rate as a preset hit rate threshold; and comparing the preset hit rate threshold with the hit rate of the target code-taking product.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any one of claims 1 to 5 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 5.
CN202010880728.3A 2020-08-27 2020-08-27 Product code-fetching method, device, computer equipment and storage medium Active CN112015758B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010880728.3A CN112015758B (en) 2020-08-27 2020-08-27 Product code-fetching method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010880728.3A CN112015758B (en) 2020-08-27 2020-08-27 Product code-fetching method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112015758A CN112015758A (en) 2020-12-01
CN112015758B true CN112015758B (en) 2023-07-28

Family

ID=73502529

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010880728.3A Active CN112015758B (en) 2020-08-27 2020-08-27 Product code-fetching method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112015758B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101635001A (en) * 2008-07-18 2010-01-27 QlikTech国际公司 Method and apparatus for extracting information from a database
CN108573402A (en) * 2018-03-12 2018-09-25 阿里巴巴集团控股有限公司 A kind of redemption code distribution method, server and system
CN109583894A (en) * 2018-11-28 2019-04-05 阿里巴巴集团控股有限公司 Offer, verification method and the device of two dimensional code
CN110232601A (en) * 2019-06-18 2019-09-13 深圳前海微众银行股份有限公司 Card certificate management method, device, equipment and storage medium
CN110297807A (en) * 2019-07-01 2019-10-01 深圳盒子信息科技有限公司 A kind of two dimension code management method and device
CN111506603A (en) * 2020-04-23 2020-08-07 上海达梦数据库有限公司 Data processing method, device, equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190213085A1 (en) * 2018-01-11 2019-07-11 Robin Systems, Inc. Implementing Fault Domain And Latency Requirements In A Virtualized Distributed Storage System

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101635001A (en) * 2008-07-18 2010-01-27 QlikTech国际公司 Method and apparatus for extracting information from a database
CN108573402A (en) * 2018-03-12 2018-09-25 阿里巴巴集团控股有限公司 A kind of redemption code distribution method, server and system
CN109583894A (en) * 2018-11-28 2019-04-05 阿里巴巴集团控股有限公司 Offer, verification method and the device of two dimensional code
CN110232601A (en) * 2019-06-18 2019-09-13 深圳前海微众银行股份有限公司 Card certificate management method, device, equipment and storage medium
CN110297807A (en) * 2019-07-01 2019-10-01 深圳盒子信息科技有限公司 A kind of two dimension code management method and device
CN111506603A (en) * 2020-04-23 2020-08-07 上海达梦数据库有限公司 Data processing method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN112015758A (en) 2020-12-01

Similar Documents

Publication Publication Date Title
CN105827706B (en) Message pushing device and method
CA3068345C (en) Witness blocks in blockchain applications
CN110597825B (en) Data processing method and device based on block chain and node equipment
US9355250B2 (en) Method and system for rapidly scanning files
CN111314238A (en) Token management method and device, storage medium and electronic device
CN109918382A (en) Data processing method, device, terminal and storage medium
CN111652685A (en) Information processing method, information processing device, computer equipment and computer readable storage medium
CN114691617A (en) Intelligent terminal data compression redundancy-prevention interaction method and device and related components
CN111913913B (en) Access request processing method and device
CN111080233B (en) Method, device and storage medium for generating subscription information
CN112015758B (en) Product code-fetching method, device, computer equipment and storage medium
CN111190858B (en) Method, device, equipment and storage medium for storing software information
CN112800123A (en) Data processing method, data processing device, computer equipment and storage medium
CN112783866A (en) Data reading method and device, computer equipment and storage medium
CN111191082A (en) Data management method and device, computer equipment and storage medium
CN112800033B (en) Data operation request processing method and device, computer equipment and storage medium
CN113409051B (en) Risk identification method and device for target service
CN113411395B (en) Access request routing method, device, computer equipment and storage medium
CN116522395B (en) Method and system for processing data files in big data storage system
CN117194350B (en) Document storage method and system in engineering construction stage of data center
CN116132528B (en) Flight management message pushing method and device and electronic equipment
CN110489515B (en) Address book retrieval method, server and storage medium
CN115865857A (en) Response data pushing method and device, computer equipment and storage medium
WO2018184509A1 (en) Data processing method and apparatus
CN115794807A (en) Data updating method, device, equipment, storage medium and computer program product

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
GR01 Patent grant
GR01 Patent grant