CN117933998A - Wind control real-time calculation method and device based on Redis cache - Google Patents

Wind control real-time calculation method and device based on Redis cache Download PDF

Info

Publication number
CN117933998A
CN117933998A CN202311716144.2A CN202311716144A CN117933998A CN 117933998 A CN117933998 A CN 117933998A CN 202311716144 A CN202311716144 A CN 202311716144A CN 117933998 A CN117933998 A CN 117933998A
Authority
CN
China
Prior art keywords
transaction
target
information
wind control
data
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
CN202311716144.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.)
Shenzhen Qianhe Information Technology Co ltd
Original Assignee
Shenzhen Qianhe Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Qianhe Information Technology Co ltd filed Critical Shenzhen Qianhe Information Technology Co ltd
Priority to CN202311716144.2A priority Critical patent/CN117933998A/en
Publication of CN117933998A publication Critical patent/CN117933998A/en
Pending legal-status Critical Current

Links

Landscapes

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

Abstract

The application provides a wind control real-time calculation method based on Redis cache, which comprises the following steps: constructing an ordered set and a hash set in the Redis cache; wherein, the ordered set stores the current transaction information of all accounts; the hash set stores time period transaction information; the time period transaction information comprises statistical information of all time period intervals; when transaction detail data of a target transaction are received, transaction information of a target time period interval corresponding to the target transaction is updated according to the transaction detail data. By storing the statistical information of the transaction information according to the time interval, the problem of extremely high operation and maintenance IT and technical cost is solved, the response time of the transaction wind control system is increased from 500ms to 5ms on average from each request with extremely low IT and technical cost, the request processing efficiency is increased by 100 times, and the complex real-time calculation service scene needs are met.

Description

Wind control real-time calculation method and device based on Redis cache
Technical Field
The application relates to the technical field of Internet financial wind control, in particular to a wind control real-time calculation method and device based on Redis cache.
Background
Typically, payment related transactions of internet finance companies require specific risk control to circumvent fraud that may occur during transactions. The most core technical point of the wind control technical scheme based on rule judgment is how to calculate the statistics of all transaction amounts and transaction counts under specific dimensions very quickly. The earliest wind control system can carry out statistics based on the traditional relational database, so that the technical cost is low, but the wind control calculation efficiency is also the lowest, and the calculation speed based on the traditional relational database can not meet the service requirement completely along with the vigorous development of payment service scenes. In order to solve such problems, after the transaction is completed, the transaction data needs to be calculated and counted in real time and stored in a database, so that real-time rule judgment is made for the next transaction.
In existing real-time wind control solutions, real-time computing frameworks such as Flink, sparkStream and KAFKASTREAM are generally used, and these frameworks are complex and perfect in function, but the technical cost of use and maintenance and IT cost are very high.
Disclosure of Invention
In view of the foregoing, the present application provides a method and apparatus for wind-controlled real-time computing based on Redis cache, which overcomes the foregoing problems or at least partially solves the foregoing problems, and includes:
a method for wind-controlled real-time computation based on Redis buffering, the method comprising:
Constructing an ordered set and a hash set in the Redis cache; wherein, the ordered set stores the current transaction information of all accounts; the hash set stores time period transaction information; the time period transaction information comprises statistical information of all time period intervals;
When transaction detail data of a target transaction are received, transaction information of a target time period interval corresponding to the target transaction is updated according to the transaction detail data.
Further, the step of updating the transaction information of the target time period section corresponding to the target transaction according to the transaction detail data includes:
determining the target time period interval corresponding to the target transaction in the hash set according to the transaction detail data;
and accumulating the transaction amount and the transaction number of the transaction detail data into the transaction information of the target time period.
Further, the method further comprises:
When transaction detail data of a transaction is received, updating current day transaction information of an account corresponding to the target transaction according to the transaction detail data;
when a transaction wind control calculation signal is received, obtaining wind control rule information arranged on a wind control configuration platform;
Inquiring corresponding statistical data in the Redis cache according to the wind control rule information and the transaction detail data;
and evaluating the statistical data according to the wind control rule to determine the risk of the target transaction.
Further, the step of updating the current day transaction information of the account corresponding to the target transaction according to the transaction detail data includes:
Determining a target set corresponding to the account corresponding to the target transaction in the ordered set according to the transaction detail data;
And updating the transaction information in the target set according to the transaction detail data.
Further, the step of querying corresponding statistical data in the dis cache according to the wind control rule information and the transaction detail data includes:
Determining a target data storage set according to the wind control rule information;
And acquiring target statistical data corresponding to the transaction detail data from the target data storage set according to the wind control rule information.
Further, the step of obtaining the target statistical data corresponding to the transaction detail data in the target data storage set according to the wind control rule information includes:
When the target data storage set is the hash set, determining a target time section according to the wind control rule information and the transaction detail data;
Inquiring and acquiring the target statistical data in the hash set according to the target time section;
And when the target data storage set is the ordered set, inquiring and acquiring the target statistical data in the ordered set according to the wind control rule information and the transaction detail data.
Further, the step of evaluating the statistical data according to the wind control rule to determine the risk of the target transaction includes:
and evaluating the statistical data according to the wind control rule information, and continuing the transaction when the condition is met, otherwise, ending the transaction.
A windage real-time computing device based on Redis buffering, the device comprising:
A storage set construction module for constructing an ordered set and a hash set in the Redis cache; wherein, the ordered set stores the current transaction information of all accounts; the hash set stores time period transaction information; the time period transaction information comprises statistical information of all time period intervals;
and the time period transaction information writing module is used for updating the transaction information of the target time period section corresponding to the target transaction according to the transaction detail data when the transaction detail data of the target transaction are received.
An apparatus comprising a processor, a memory and a computer program stored on the memory and capable of running on the processor, which when executed by the processor implements the steps of the method for windage real-time computing based on Redis cache as described above.
A computer readable storage medium having stored thereon a computer program which when executed by a processor implements the steps of a method of wind controlled real time computing based on Redis cache as described above.
The application has the following advantages:
In the embodiment of the application, compared with the problem of high technical cost and IT cost of use and maintenance in the prior art, the application provides a Hash storage solution based on time period interval cutting, which specifically comprises the following steps: constructing an ordered set and a hash set in the Redis cache; wherein, the ordered set stores the current transaction information of all accounts; the hash set stores time period transaction information; the time period transaction information comprises statistical information of all time period intervals; when transaction detail data of a target transaction are received, transaction information of a target time period interval corresponding to the target transaction is updated according to the transaction detail data. By storing the statistical information of the transaction information according to the time interval, the problem of extremely high operation and maintenance IT and technical cost is solved, the response time of the transaction wind control system is increased from 500ms to 5ms on average from each request with extremely low IT and technical cost, the request processing efficiency is increased by 100 times, and the complex real-time calculation service scene needs are met.
Drawings
In order to more clearly illustrate the technical solutions of the present application, the drawings that are needed in the description of the present application will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of steps of a method for wind-controlled real-time computation based on Redis cache according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a wind-controlled real-time computing method based on Redis cache according to an embodiment of the present application;
FIG. 3 is a flowchart illustrating a data writing and storing scheme of a wind-controlled real-time computing method based on Redis cache according to an embodiment of the present application;
FIG. 4 is a flowchart illustrating a data reading scheme of a wind-controlled real-time computing method based on Redis cache according to an embodiment of the present application;
FIG. 5 is a block diagram of a wind-controlled real-time computing device based on Redis cache according to an embodiment of the present application;
Fig. 6 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
In order that the manner in which the above recited objects, features and advantages of the present application are obtained will become more readily apparent, a more particular description of the application briefly described above will be rendered by reference to the appended drawings. It will be apparent that the described embodiments are some, but not all, embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The inventors found by analyzing the prior art that: in the current real-time wind control solution, for example, a solution based on a link is needed to send detailed transaction information to a Kafka message queue after each real-time transaction is successful, after the transaction information is obtained from the Kafka message queue in real time by a link cluster, statistics of transaction amount and number are carried out according to a certain calculation rule, the statistics of transaction amount and number are written into a database for storage after calculation is completed, and the calculated statistics data are read from the database for subsequent transactions. The method has the advantages that the data volume which can be processed in the method is larger, the data time limit is longer, the method is more suitable for real-time wind control of a very large-scale transaction scene, but in the scheme, a large amount of IT resources are needed for supporting, for example, a Kafka cluster, a Flink cluster and a database storage cluster are all needed to be supported with stronger operation and maintenance capability, and the technical cost is very high.
It should be noted that, in any embodiment of the present invention, redis is an open source written using ANSIC, including various data structures, supporting networks, memory-based, optionally persistent key-value pairs, and storage databases. Redis is based on memory, so its biggest feature is extremely fast reading speed.
1-2, A wind control real-time calculation method based on Redis cache is shown;
The method comprises the following steps:
S110, constructing an ordered set and a hash set in the Redis cache; wherein, the ordered set stores the current transaction information of all accounts; the hash set stores time period transaction information; the time period transaction information comprises statistical information of all time period intervals;
s120, when transaction detail data of a transaction are received, updating transaction information of a target time period interval corresponding to the target transaction according to the transaction detail data.
In the embodiment of the application, compared with the problem of high technical cost and IT cost of use and maintenance in the prior art, the application provides a Hash storage solution based on time period interval cutting, which specifically comprises the following steps: constructing an ordered set and a hash set in the Redis cache; wherein, the ordered set stores the current transaction information of all accounts; the hash set stores time period transaction information; the time period transaction information comprises statistical information of all time period intervals; when transaction detail data of a target transaction are received, transaction information of a target time period interval corresponding to the target transaction is updated according to the transaction detail data. By storing the statistical information of the transaction information according to the time interval, the problem of extremely high operation and maintenance IT and technical cost is solved, the response time of the transaction wind control system is increased from 500ms to 5ms on average from each request with extremely low IT and technical cost, the request processing efficiency is increased by 100 times, and the complex real-time calculation service scene needs are met.
Next, a wind-control real-time calculation method based on the Redis cache in the present exemplary embodiment will be further described.
In an embodiment of the present invention, the method further includes:
s130, when transaction detail data of a transaction are received, updating current day transaction information of an account corresponding to the target transaction according to the transaction detail data;
s140, when a transaction wind control calculation signal is received, obtaining wind control rule information arranged on a wind control configuration platform;
S150, inquiring corresponding statistical data in the Redis cache according to the wind control rule information and the transaction detail data;
S160, evaluating the statistical data according to the wind control rule to determine the risk of the target transaction.
Constructing an ordered set and a hash set in the Redis cache as described in the step S110; wherein, the ordered set stores the current transaction information of all accounts; the hash set stores time period transaction information; the time period transaction information includes statistics of all time period intervals.
In one embodiment of the present invention, the specific process of "building an ordered set and a hash set in the Redis cache" described in step S110 may be further described in conjunction with the following description.
As an example, the Hash set is based on REDISHASH data structure, the Hash structure has three elements, key is a unique identifier, field is a combination of a series of transaction attribute information+a time period interval, value is a combination of total amount and total number of strokes, and the Hash data structure is as follows:
Key: a string of unique identification + { merchant number } + date, such as: risk. Interval. Mcht. { merchant number }.20230902.Summary;
Fields: a series of transaction attribute information + time period interval combinations, the format and attribute sequence of the combinations are fixed: { date } { settlement period-SETTLECYCLE } { transaction type-txCode } { sub-transaction type-subTxCode }, like: 0940.sy1.tx00.stx31, representing 2023.09.02 days, 09:40 minutes, settlement period of 1, transaction type of 00, sum of transaction amounts for all transactions of sub-transaction type 31, and sum of transaction counts;
Value: the combination of the total amount and the total number of strokes, the upper level represents the amount, and the lower level represents the number of strokes, for example 10000000001 is 10000000001/(1000 x 10000) =1000 yuan, and the leftmost 1 is 1 transaction.
As an example, the time period interval is used to solve the time dynamics problem when statistics;
for a certain second time, such as 2023.09.02.17:45:13, this may be denoted 20230826174513;
for this timestamp, one bit is reduced: 2023022617451, representing a 17:45 minute 10 second to 19 second statistic;
One more bit is reduced: 202308261745, representing a 17:45 minute statistic;
One more bit is reduced: 20230826174, representing a10 minute statistic from 17:40 minutes to 17:49 minutes;
one more bit is reduced: 2023082617, representing a 17-point hour statistic;
One more bit is reduced: 202308261, representing a 10-hour statistic from 10 to 19;
one more bit is reduced: 20230826, representing the statistics of the day of the 8 months and 26 days.
By the method, the time period of one whole day is segmented according to a certain rule, and after segmentation, the statistical data in any time range can be obtained by calculating the sum of a plurality of simple intervals.
Meanwhile, for the calculation of the cross-day, one bit can be reduced: 2023082, representing statistics of 8 months 20 days to 29 days 8 months;
one more bit is reduced: 202308, representing a statistics of 8 months over a month.
As an example, the ordered set is based on RedisSortedSet data structure (Zset) and includes three elements, keys: a unique data identifier; value: member, score: score of the member. The order of the members in this set is sorted by score, and all transaction details data of the day of each bank card or each transaction box are stored in Zset, and the RedisSortedSet data structure is as follows:
Key: a string of unique identification + { bank card number/box number of transaction } +date, such as risk. Card } { card number } {20230902}. Surmmary;
Vaule: a combined string for a plurality of transaction attribute information, such as: 000000100000311OR5201908051636527466SN001310195002087MN018440395000556, namely "{ amount: 0000001000 { type }: 00 { subtype }: 31 { settlement period: 1} or.. SN... MN..,";
score: a time stamp accurate to seconds, such as 20230902094059, represents 2023.09.0209:40:59.
Wherein the first 10 digits of the Vaule portion are the amount, accurate to the point, in the example the amount is 0000001000, i.e. 10 yuan; bits 11, 12 are transaction type, bits 13, 14 are transaction subtype, and bit 15 represents settlement period, i.e. transaction type: 00, transaction subtype: 31, settlement period: 0; the first 15 bits of the predetermined data are fixed length parts, and the data after the 15 th bit are non-fixed length parts; the above-mentioned indefinite length part is used for storing attribute information when trade, it is made up of name and content, if need to represent trade business number information of trade, the business number is name, abbreviated as MN, the content is the concrete business number, then the business number 018440395000556 in the trade information is represented as MN018440395000556. For another example, OR5201908051636527466, OR represents an order code, i.e., order number 201908051636527466, and so on. This portion of data may be augmented with attribute information by any specified name, with SN in the example representing the transaction box number.
Referring to fig. 3, as described in the step S120, when transaction detail data of a transaction is received, transaction information of a target time period section corresponding to the target transaction is updated according to the transaction detail data.
In an embodiment of the present invention, the specific process of "updating the transaction information of the target time period interval corresponding to the target transaction" in step S120 according to the transaction detail data may be further described in conjunction with the following description.
Determining the target time period interval corresponding to the target transaction in the hash set according to the transaction detail data;
And accumulating the transaction amount and the transaction number of the transaction detail data into the transaction information of the target time period interval as follows.
As an example, the time point of the target transaction is calculated as reference, which specific time intervals the time point belongs to, the transaction amount of the target transaction is accumulated in the time intervals, meanwhile, the transaction amount in the time intervals is increased by 1 time, and then the transaction amount is stored in the REDIS HASH Hash set in the Hash data structure. Thus, the real-time calculation of the wind control data is completed and stored in the Redis cache, and when the subsequent transaction occurs and wind control rule judgment is carried out, the corresponding wind control statistical data can be directly and rapidly obtained from the Redis at one time to carry out wind control judgment, so that the response efficiency of wind control is greatly improved.
Referring to fig. 3, as described in the step S130, the current day transaction information of the account corresponding to the target transaction is updated according to the transaction detail data.
In an embodiment of the present invention, the specific process of "updating the current day transaction information of the account corresponding to the target transaction according to the transaction detail data" in step S130 may be further described in conjunction with the following description.
Determining a target set corresponding to an account corresponding to the target transaction in the ordered set according to the transaction detail data;
And updating the transaction information in the target set according to the transaction detail data as follows.
As an example, an account corresponding to the target transaction is determined according to the transaction detail data, a target set corresponding to the account is determined in the ordered set, the original data of the transaction detail data are spliced according to the RedisSortedSet data structure rule, and then the spliced data are stored in the corresponding target set in the Redis Sorted Set ordered set data structure in different dimensions, wherein the dimensions comprise a dimension of a bank card and a dimension of a box number, and each set stores all transaction details of a certain bank card or box number occurring on the same day.
As described in step S140, when a transaction wind control calculation signal is received, wind control rule information set in the wind control configuration platform is obtained.
In an embodiment of the present invention, the specific process of "obtaining the wind control rule information set on the wind control configuration platform" in step S140 may be further described in conjunction with the following description.
As an example, a wind control business manager defines and enters wind control rules on a wind control management platform; when a payment transaction occurs, the transaction service requests a wind control core service to perform risk control judgment; the wind control core service requests the wind control management platform to acquire rule information which is defined and recorded in advance.
Referring to fig. 4, as described in the step S150, corresponding statistics are queried in the Redis cache according to the wind control rule information and the transaction detail data.
In an embodiment of the present invention, the specific process of "querying the dis cache for the corresponding statistics according to the wind control rule information and the transaction detail data" in step S150 may be further described in conjunction with the following description.
And determining a target data storage set according to the wind control rule information as follows.
As an example, if the data statistics time of the wind control rule is on the day of the transaction, then query from the ordered collection; if the data statistics time of the wind control rule is a transaction period greater than the day of the transaction, such as 2 days, a month, or a year, then a query is made from the hash set.
And according to the wind control rule information, acquiring target statistical data corresponding to the transaction detail data from the target data storage set as described in the following steps.
As an example, determining a target query keyword for query and target query data to be queried according to the wind control rule information, determining a target query set corresponding to the transaction detail data in the target data storage set, and acquiring target statistical data in the target query set according to the target query keyword and the target data.
In an embodiment of the present invention, the specific process of the step of "obtaining the target statistics corresponding to the transaction detail data in the target data storage set according to the wind control rule information" may be further described in conjunction with the following description.
Determining a target time section according to the wind control rule information and the transaction detail data when the target data storage set is the hash set as follows;
the target statistics are queried and obtained in the hash set according to the target time segment, as described in the following steps.
As an example, all time period intervals included in the time range of the target time period are calculated, then data conforming to the regulation of the wind control rule is obtained from the REDIS HASH hash set at one time by using the Redis batch command, and then addition or subtraction calculation is performed to obtain a statistical value.
In one embodiment, the statistics of 7 minutes, queries 2023.09.2817:42 to 2023.09.2817:48, are provided for the following time period:
[1742,1743,1744,1745,1746,1747,1748] the field value is obtained once by REDISHMGET command and then added.
As an example, the structural rules of the dis batch command are as follows:
key rule: a string of unique identification + { merchant number } + date.
Risk. Interval. Mcht { merchant number }.20230902. Discussion: time 20230902, statistics representing 2023.09.02 this day;
risk. Interval. Mcht { merchant number }.202309. Discussion: time 202309, statistics representing 2023.09 this month;
The Field rule: a series of transaction attribute information + time period interval combinations, the format and attribute sequence of the combinations being fixed.
The data format is fixed to { date } { SETTLECYCLE } { txCode } { subTxCode }, sy represents the settlement period, tx represents the transaction type, and stx represents the sub-transaction type.
In key: risk. Interval. Mcht. { merchant number }.20230902. Discussion is an example;
field:1540.sy1.tx00.stx31, representing 15:40 minutes, settlement period 1, transaction type 00, sub-transaction type 31, statistics under these transaction attributes;
field: sy1.tx00.stx31 represents a 10 minute statistic of 15:40-15:49;
field: sy1.tx00.stx31, representing statistics for one hour 15:00-15:59;
in key: risk. Interval. Mcht. { merchant number }.202309. Discussion is an example;
field:0902.sy1.tx00.stx31, representing the day of 9 months and 2 days, settlement period 1, transaction type 00, sub-transaction type 31, statistics under these transaction attributes;
field:090.sy1.tx00.stx31, representing a 10 day statistic of 9 months 1 day to 9 months 9 days;
field: sy1.Tx00.Stx31, representing a statistics of 9 months of the month;
value rule: the combination of the total amount and the total number of strokes, the upper level representing the amount and the lower level representing the number of strokes (i.e., the upper level is left to right and the lower level is right to left for the stored prescription of computer science).
Taking 10000000001 as an example;
The high order is: 10000000000, i.e. 10000000000/(1000 x 10000) =1000 yuan;
The lower bits are: 1, the transaction number is 1.
In one embodiment, the statistics of queries 2023.09.2817:48 to 2023.09.2819:58 for 2 hours and 10 minutes are as follows:
[1748,1749,175,18,190,191,192,193,194,1950,1951,1952,1953,1964,1955,1956,1957,1958] the total number of the components, i.e.,
17:48 Minutes to 17:49 minutes, 1 minute
17:50 Minutes-17:59 minutes, 10 minutes (i.e., interval 175)
18:00 Points, this one hour (i.e. interval 18)
19:00-19:49 Minutes, 50 minutes (i.e., 190-194, i.e., 19:00-19:49, note that 19:50 here is counted in the next time interval)
19:50 Minutes to 19:58 minutes, which is 9 minutes (i.e., 1950-1958).
Or may also be
[1748,1749,175,18,19] Minus [1959] this time period, i.e
17:48 Minutes to 17:49 minutes, 1 minute
17:50 Minutes-17:59 minutes, 10 minutes (i.e., interval 175)
18:00 Points, this one hour (i.e. interval 18)
19:00 Points, this one hour (i.e. interval 19)
Subtracting the 19:59 min statistic, the result is the same as the algorithm above.
In a specific implementation, under the condition that the same merchant number is counted, the transaction type is card swiping (tx 00), the sub transaction type is magnetic stripe card consumption (stx 31), the settlement period T+1 is 2 days, and the transaction number cannot exceed 1000.
The inquiry time period interval is 2 days, namely the inquiry month hashkey, hashfield of the current day and the previous day is obtained, and the transaction number in 2 days of the current merchant is obtained and compared with the upper limit 1000 of the transaction number;
Taking 2023.09.02 days as an example, month hashkey is: risk. Interval. Mcht. { merchant number }.202309.Summary, field is: 09.01 and 09.02, the transaction type is swiped and the sub-transaction type is a combination of magnetic stripe card consumption;
By the Redis command: "HMGET" "" risk.interval.mcht { merchant }.202309. Discussion "" "0902.sy1.Tx00.Stx31" ""0901.Sy. Tx00.Stx31"", the statistics of two days are read at a time to determine the total number of transactions, and finally, the total number of transactions is compared with the upper limit 1000 of the number of transactions.
And when the target data storage set is the ordered set, inquiring and acquiring the target statistical data in the ordered set according to the wind control rule information and the transaction detail data as described in the following steps.
As an example, all values meeting the requirements are obtained from Redis Sorted Set ordered sets according to the time range and transaction attribute in the rule, and then calculated to obtain statistics
In one implementation, a card needs to be queried, and all transaction types are the transaction amounts of WeChat payment under the same merchant in a certain period of a certain day.
According to the requirements, only one Zset needs to be searched, and the second-level time stamp of the time range is calculated, for example, the time stamp is 20230902110806-20230902120915 from 11:08:06 seconds to 12:09:15 seconds in 2023.09.02 midday; finding out all data in the time range through zRangeByScore commands, and filtering out data meeting the conditions by comparing the merchant numbers in the module values with the transaction types; and summarizing and calculating the transaction amount of the data meeting the conditions to obtain a result.
It should be noted that the whole query and filter calculation is completed by the Lua script in the Redis by a quick one-time calculation.
The risk of the target transaction is determined by evaluating the statistical data according to the wind control rules, as described in the step S160.
In one embodiment of the present invention, the specific process of "evaluating the statistical data to determine the risk of the target transaction according to the wind control rule" described in step S160 may be further described in conjunction with the following description.
And evaluating the statistical data according to the wind control rule information, and continuing the transaction when the condition is met, otherwise, ending the transaction.
As an example, the statistical data is evaluated according to a rule preset in the wind control rule information, when the statistical data meets a condition, a transaction continuing response is returned, otherwise, a transaction ending response is returned, and after the transaction system receives the response, the transaction request is continued or ended according to the response type.
In a specific implementation, under the condition that the preset rule in the wind control rule information is the same merchant number, txCode is 00, the subttxcode is 31, the number of transactions cannot exceed 10 in 2 days within the time range; the statistical data TxCode is 00, the number of transactions in 31,2 days is 8, so that the statistics meet the rule, and a transaction continuing response is returned.
For the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points.
Referring to fig. 5, there is shown a wind-controlled real-time computing device based on Redis cache according to an embodiment of the present application,
The method specifically comprises the following steps:
A storage set construction module 510, configured to construct an ordered set and a hash set in the dis cache; wherein, the ordered set stores the current transaction information of all accounts; the hash set stores time period transaction information; the time period transaction information comprises statistical information of all time period intervals;
And the period transaction information writing module 520 is configured to update, when transaction detail data of a target transaction is received, transaction information of a target period of time interval corresponding to the target transaction according to the transaction detail data.
In one embodiment of the present invention, the period transaction information writing module 520 includes:
a time period interval determining sub-module, configured to determine, in the hash set, the target time period interval corresponding to the target transaction according to the transaction detail data;
and the time period transaction information statistics and writing sub-module is used for accumulating the transaction amount and the transaction number of the transaction detail data into the transaction information of the target time period.
In an embodiment of the invention, the apparatus further comprises:
The current transaction information writing module is used for updating current transaction information of an account corresponding to the target transaction according to the transaction detail data when the transaction detail data of the transaction is received;
The wind control rule acquisition module is used for acquiring wind control rule information arranged on the wind control configuration platform when a transaction wind control calculation signal is received;
The statistical data module is used for inquiring corresponding statistical data in the Redis cache according to the wind control rule information and the transaction detail data;
and the risk assessment module is used for assessing the statistical data according to the wind control rule to determine the risk of the target transaction.
In an embodiment of the present invention, the current day transaction information writing module includes:
an account set determining sub-module, configured to determine, according to the transaction detail data, a target set corresponding to an account corresponding to the target transaction in the ordered set;
And the transaction information writing sub-module is used for updating the transaction information in the target set according to the transaction detail data.
In an embodiment of the present invention, the statistics module includes:
the storage set determining submodule is used for determining a target data storage set according to the wind control rule information;
And the statistical data query sub-module is used for acquiring target statistical data corresponding to the transaction detail data from the target data storage set according to the wind control rule information.
In one embodiment of the present invention, the statistics polling sub-module includes:
a hash set query unit, configured to determine a target time section according to the wind control rule information and the transaction detail data when the target data storage set is the hash set;
a hash set statistics unit, which is used for inquiring and acquiring the target statistics data in the hash set according to the target time section;
And the ordered set statistics unit is used for inquiring and acquiring the target statistics data in the ordered set according to the wind control rule information and the transaction detail data when the target data storage set is the ordered set.
In an embodiment of the present invention, the risk assessment module includes:
And the risk evaluation and processing sub-module is used for evaluating the statistical data according to the wind control rule information, and continuing the transaction when the conditions are met, or terminating the transaction.
Referring to fig. 6, a computer device of a wind control real-time computing method based on Redis cache according to the present invention may specifically include the following:
The computer device 12 described above is embodied in the form of a general purpose computing device, and the components of the computer device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, a bus 18 that connects the various system components, including the system memory 28 and the processing units 16.
Bus 18 represents one or more of several types of bus 18 structures, including a memory bus 18 or memory controller, a peripheral bus 18, an accelerated graphics port, a processor, or a local bus 18 using any of a variety of bus 18 architectures. By way of example, and not limitation, such architectures include Industry Standard Architecture (ISA) bus 18, micro channel architecture (MAC) bus 18, enhanced ISA bus 18, video Electronics Standards Association (VESA) local bus 18, and Peripheral Component Interconnect (PCI) bus 18.
Computer device 12 typically includes a variety of computer system readable media. Such media can be any available media that is accessible by computer device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM) 30 and/or cache memory 32. The computer device 12 may further include other removable/non-removable, volatile/nonvolatile computer storage media. By way of example only, storage system 34 may be used to read from or write to non-removable, nonvolatile magnetic media (commonly referred to as a "hard disk drive"). Although not shown in fig. 6, a magnetic disk drive for reading from and writing to a removable non-volatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading from or writing to a removable non-volatile optical disk such as a CD-ROM, DVD-ROM, or other optical media may be provided. In such cases, each drive may be coupled to bus 18 through one or more data medium interfaces. The memory may include at least one program product having a set (e.g., at least one) of program modules 42, the program modules 42 being configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored in, for example, a memory, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules 42, and program data, each or some combination of which may include an implementation of a network environment. Program modules 42 generally perform the functions and/or methods of the embodiments described herein.
The computer device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, camera, etc.), one or more devices that enable a user to interact with the computer device 12, and/or any devices (e.g., network card, modem, etc.) that enable the computer device 12 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 22. Moreover, computer device 12 may also communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network such as the Internet, through network adapter 20. As shown, network adapter 20 communicates with other modules of computer device 12 via bus 18. It should be appreciated that although not shown in fig. 6, other hardware and/or software modules may be used in connection with computer device 12, including, but not limited to: microcode, device drivers, redundant processing units 16, external disk drive arrays, RAID systems, tape drives, data backup storage systems 34, and the like.
The processing unit 16 executes programs stored in the system memory 28 to perform various functional applications and data processing, for example, to implement a method for wind-controlled real-time computing based on Redis cache according to an embodiment of the present invention.
That is, the processing unit 16 realizes when executing the program: constructing an ordered set and a hash set in the Redis cache; wherein, the ordered set stores the current transaction information of all accounts; the hash set stores time period transaction information; the time period transaction information comprises statistical information of all time period intervals; when transaction detail data of a target transaction are received, transaction information of a target time period interval corresponding to the target transaction is updated according to the transaction detail data.
In an embodiment of the present application, the present application further provides a computer readable storage medium, where a computer program is stored, where the program when executed by a processor implements a method for wind-controlled real-time computing based on Redis cache as provided in all embodiments of the present application:
That is, the program is implemented when executed by a processor: constructing an ordered set and a hash set in the Redis cache; wherein, the ordered set stores the current transaction information of all accounts; the hash set stores time period transaction information; the time period transaction information comprises statistical information of all time period intervals; when transaction detail data of a target transaction are received, transaction information of a target time period interval corresponding to the target transaction is updated according to the transaction detail data.
Any combination of one or more computer readable media may be employed. The computer readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Computer program code for carrying out operations of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider). In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described by differences from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
While preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiment and all such alterations and modifications as fall within the scope of the embodiments of the application.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or terminal device that comprises the element.
The application provides a method and a device for wind control real-time calculation based on Redis cache, which are described in detail, wherein specific examples are applied to illustrate the principle and the implementation of the application, and the description of the above examples is only used for helping to understand the method and the core idea of the application; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present application, the present description should not be construed as limiting the present application in view of the above.

Claims (10)

1. The wind control real-time calculation method based on Redis cache is characterized by comprising the following steps of:
Constructing an ordered set and a hash set in the Redis cache; wherein, the ordered set stores the current transaction information of all accounts; the hash set stores time period transaction information; the time period transaction information comprises statistical information of all time period intervals;
When transaction detail data of a target transaction are received, transaction information of a target time period interval corresponding to the target transaction is updated according to the transaction detail data.
2. The method according to claim 1, wherein the step of updating the transaction information of the target time period section corresponding to the target transaction according to the transaction detail data includes:
determining the target time period interval corresponding to the target transaction in the hash set according to the transaction detail data;
and accumulating the transaction amount and the transaction number of the transaction detail data into the transaction information of the target time period.
3. The method according to claim 1, wherein the method further comprises:
When transaction detail data of a transaction is received, updating current day transaction information of an account corresponding to the target transaction according to the transaction detail data;
when a transaction wind control calculation signal is received, obtaining wind control rule information arranged on a wind control configuration platform;
Inquiring corresponding statistical data in the Redis cache according to the wind control rule information and the transaction detail data;
and evaluating the statistical data according to the wind control rule to determine the risk of the target transaction.
4. A method according to claim 3, wherein the step of updating the current day transaction information of the account corresponding to the target transaction in accordance with the transaction detail data comprises:
Determining a target set corresponding to the account corresponding to the target transaction in the ordered set according to the transaction detail data;
And updating the transaction information in the target set according to the transaction detail data.
5. A method according to claim 3, wherein the step of querying the dis cache for corresponding statistics in accordance with the wind control rule information and the transaction detail data comprises:
Determining a target data storage set according to the wind control rule information;
And acquiring target statistical data corresponding to the transaction detail data from the target data storage set according to the wind control rule information.
6. The method of claim 5, wherein the step of obtaining target statistics corresponding to the transaction detail data in the target data storage set according to the wind control rule information comprises:
When the target data storage set is the hash set, determining a target time section according to the wind control rule information and the transaction detail data;
Inquiring and acquiring the target statistical data in the hash set according to the target time section;
And when the target data storage set is the ordered set, inquiring and acquiring the target statistical data in the ordered set according to the wind control rule information and the transaction detail data.
7. A method according to claim 3, wherein the step of evaluating the statistical data in accordance with the wind control rules to determine the risk of the target transaction comprises:
and evaluating the statistical data according to the wind control rule information, and continuing the transaction when the condition is met, otherwise, ending the transaction.
8. A windage real-time computing device based on Redis buffering, the device comprising:
A storage set construction module for constructing an ordered set and a hash set in the Redis cache; wherein, the ordered set stores the current transaction information of all accounts; the hash set stores time period transaction information; the time period transaction information comprises statistical information of all time period intervals;
and the time period transaction information writing module is used for updating the transaction information of the target time period section corresponding to the target transaction according to the transaction detail data when the transaction detail data of the target transaction are received.
9. An apparatus comprising a processor, a memory, and a computer program stored on the memory and capable of running on the processor, which when executed by the processor, implements the method of any one of claims 1 to 7.
10. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the method according to any of claims 1 to 7.
CN202311716144.2A 2023-12-13 2023-12-13 Wind control real-time calculation method and device based on Redis cache Pending CN117933998A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311716144.2A CN117933998A (en) 2023-12-13 2023-12-13 Wind control real-time calculation method and device based on Redis cache

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311716144.2A CN117933998A (en) 2023-12-13 2023-12-13 Wind control real-time calculation method and device based on Redis cache

Publications (1)

Publication Number Publication Date
CN117933998A true CN117933998A (en) 2024-04-26

Family

ID=90749630

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311716144.2A Pending CN117933998A (en) 2023-12-13 2023-12-13 Wind control real-time calculation method and device based on Redis cache

Country Status (1)

Country Link
CN (1) CN117933998A (en)

Similar Documents

Publication Publication Date Title
US20060074621A1 (en) Apparatus and method for prioritized grouping of data representing events
Jain et al. Refreshing datawarehouse in near real-time
CN111062799A (en) Method and device for managing family client, electronic equipment and storage medium
US11188981B1 (en) Identifying matching transfer transactions
CN112925664A (en) Target user determination method and device, electronic equipment and storage medium
CN110889754B (en) Method for improving processing efficiency of non-overdraft hot spot account
CN114090601B (en) Data screening method, device, equipment and storage medium
CN110737727B (en) Data processing method and system
CN113535677B (en) Data analysis query management method, device, computer equipment and storage medium
WO2021088820A1 (en) Post-loan information management method and apparatus, device, and storage medium
WO2019095569A1 (en) Financial analysis method based on financial and economic event on microblog, application server, and computer readable storage medium
CN112347102B (en) Multi-table splicing method and multi-table splicing device
CN117933998A (en) Wind control real-time calculation method and device based on Redis cache
WO2019196502A1 (en) Marketing activity quality assessment method, server, and computer readable storage medium
CN112070564B (en) Advertisement pulling method, device and system and electronic equipment
CN112861140B (en) Service data processing method and device and readable storage medium
CN114356712A (en) Data processing method, device, equipment, readable storage medium and program product
CN111598714A (en) Two-stage unsupervised group partner identification method and device and electronic equipment
CN112084408A (en) List data screening method and device, computer equipment and storage medium
CN110544165A (en) credit risk score card creating method and device and electronic equipment
CN115017875B (en) Enterprise information processing method, device, system, equipment and medium
CN110648208B (en) Group identification method and device and electronic equipment
CN117332212B (en) Intelligent risk exploration method and system based on chaotic engineering fault experiment
CN114584616B (en) Message pushing method and device, electronic equipment and storage medium
CN114897613A (en) Abnormal transaction behavior detection method and system, electronic device and storage medium

Legal Events

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