Popup window control method and device based on Redis, medium and electronic equipment
By using Redis cache to store pop-up data on the server side, the problem of database read and write operations in the prior art consume server resources, achieving more efficient pop-up control and lower operating costs.
Patent Information
- Application Number
- CN202411577825.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-02-14
AI Technical Summary
In the prior art, the data displayed by the user's pop-up window through the database management database leads to a large number of database read and write operations, consumes server resources, and increases operating costs.
Redis cache is used to store the mapping relationship between pop-up identifier and pop-up data, so as to obtain the pop-up data of the target pop-up window through Redis on the server and control the display of pop-up windows.
It improves the response speed and processing efficiency of pop-up windows, reduces the load of the back-end database, reduces the consumption of server resources, and reduces the operating costs.
Smart Images

Figure CN119440705A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a pop-up window control method, device, medium and electronic device based on Redis. Background Art
[0002] In modern Internet applications, homepage pop-ups are a common way of user interaction, used to push notifications, advertisements, promotions, etc. However, improper pop-up frequency control may cause users to feel annoyed, and even reduce user satisfaction and retention rate. Therefore, reasonable control of pop-up display frequency is the key to improving user experience and business results.
[0003] In the prior art, a database is used to store and manage the pop-up display data of users. When a user visits the homepage, the system will query the database and decide whether to display the pop-up window according to preset rules. These rules may include the priority of the pop-up window, the user type, the frequency of the pop-up window, etc. A large number of database read and write operations consume a lot of server resources, thereby increasing operating costs. Summary of the invention
[0004] The embodiments of the present application provide a pop-up window control method, device, medium and electronic device based on Redis. In order to have a basic understanding of some aspects of the disclosed embodiments, a simple summary is given below. This summary is not a general review, nor is it intended to determine the key / important components or describe the scope of protection of these embodiments. Its only purpose is to present some concepts in a simple form as a preface to the detailed description that follows.
[0005] In a first aspect, an embodiment of the present application provides a pop-up window control method based on Redis, which is applied to a server, and the method includes:
[0006] In response to an access request sent by a client, query the configuration information of each pop-up window pre-configured in the system, where the access request is used to access the homepage of the system;
[0007] According to the priority included in the configuration information of each pop-up window, the pop-up windows are sorted in order of priority to obtain a pop-up window list;
[0008] Obtain the pop-up window data of the target pop-up window from the Redis cache; the Redis cache is used to store the mapping relationship between the pop-up window identifier and the pop-up window data, and the pop-up window data is used to represent the historical display information of the target pop-up window. The target pop-up window is each pop-up window traversed from the pop-up window list;
[0009] Based on the pop-up window data of the target pop-up window, control the display of the target pop-up window on the client.
[0010] Optionally, the access request carries a user ID, and the configuration information of each pop-up window includes the pop-up window ID;
[0011] Get the pop-up window data of the target pop-up window from the Redis cache, including:
[0012] Get the pop-up window ID of the target pop-up window;
[0013] Concatenate the pop-up window ID of the target pop-up window with the user ID to obtain a pop-up window identifier;
[0014] According to the pop-up window identifier, the corresponding pop-up window data is obtained from the mapping relationship as the pop-up window data of the target pop-up window.
[0015] Optionally, based on the pop-up window data of the target pop-up window, control the display of the target pop-up window on the client, including:
[0016] When the pop-up window data of the target pop-up window is empty, the target pop-up window is sent to the client for display; or,
[0017] When the pop-up window data of the target pop-up window is not empty, the target date of the last pop-up window judgment and the continuous pop-up window details are obtained from the pop-up window data of the target pop-up window. The continuous pop-up window details are the number of pop-ups per day from the target date to the current date.
[0018] Based on the target date and the continuous pop-up window details, control the display of the target pop-up window on the client.
[0019] Optionally, based on the target date and the continuous pop-up window details, control the display of the target pop-up window on the client, including:
[0020] Determine whether the number of pop-up windows per day from the target date to the current date is missing;
[0021] If yes, use 0 to fill in the missing pop-up window times for the date to get the final continuous pop-up window details;
[0022] The number of days of the cycle is calculated based on the pre-configured pop-up frequency, which is used to indicate the time interval for repeated display of the target pop-up;
[0023] According to the cycle days and the continuous pop-up details, calculate the total number of pop-ups on the current date and the number of pop-ups on the day;
[0024] Based on the total number of pop-up windows and the number of pop-up windows on the day, control the target pop-up windows to be displayed on the client.
[0025] Optionally, based on the total number of pop-ups and the number of pop-ups on the day, control the display of target pop-ups on the client, including:
[0026] When the number of pop-up windows on the day is less than the preset daily pop-up window number threshold and the total number of pop-up windows is less than the preset total pop-up window number threshold, the target pop-up window is sent to the client for display; or,
[0027] When the number of pop-up windows on the day is equal to the preset daily pop-up window number threshold or the total number of pop-up windows is equal to the preset total number of pop-up windows threshold, traverse the next target pop-up window in the pop-up window list.
[0028] Optionally, when the pop-up window data of the target pop-up window is empty, after sending the target pop-up window to the client for display, the method further includes:
[0029] Get the current date as the target date for the last pop-up judgment;
[0030] Set the number of pop-up windows for the current date to 1 as the continuous pop-up window details;
[0031] Combine the target date of the last pop-up window judgment with the continuous pop-up window details data to form the final pop-up window data of the target pop-up window;
[0032] The mapping relationship between the pop-up window identifier and the final pop-up window data is stored in the Redis cache.
[0033] Optionally, when the number of pop-up windows on the day is less than a preset daily pop-up window number threshold and the total number of pop-up windows is less than a preset total pop-up window number threshold, after sending the target pop-up window to the client for display, the method further includes:
[0034] The number of pop-up windows on the day is increased by 1 to update the number of pop-up windows on the day in the final continuous pop-up window detail data to obtain the updated continuous pop-up window detail data;
[0035] Get the current date as the target date for the last pop-up judgment;
[0036] Combine the target date of the last pop-up window judgment with the updated continuous pop-up window detail data to form the final pop-up window data;
[0037] The mapping relationship between the pop-up window identifier and the final pop-up window data is stored in the Redis cache.
[0038] In a second aspect, an embodiment of the present application provides a pop-up window control device based on Redis, the device comprising:
[0039] A query module, used to query the configuration information of each pop-up window pre-configured in the system in response to an access request sent by a client, where the access request is used to access the homepage of the system;
[0040] A sorting module, used to sort the pop-up windows in order of priority according to the priority included in the configuration information of each pop-up window, to obtain a pop-up window list;
[0041] The acquisition module is used to obtain the pop-up window data of the target pop-up window from the Redis cache; the Redis cache is used to store the mapping relationship between the pop-up window identifier and the pop-up window data, and the pop-up window data is used to represent the historical display information of the target pop-up window. The target pop-up window is each pop-up window traversed from the pop-up window list;
[0042] The display module is used to control the display of the target pop-up window on the client based on the pop-up window data of the target pop-up window.
[0043] In a third aspect, an embodiment of the present application provides a computer storage medium, which stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the above-mentioned method steps.
[0044] In a fourth aspect, an embodiment of the present application provides an electronic device, which may include: a processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the above-mentioned method steps.
[0045] The technical solution provided by the embodiments of the present application may have the following beneficial effects:
[0046] In an embodiment of the present application, the mapping relationship between the pop-up identifier and the pop-up data is stored in the Redis cache. The Redis has high-speed caching and data processing capabilities. Therefore, the pop-up data of the target pop-up window is obtained from the Redis cache to implement the pop-up control method. This can improve the response speed and processing efficiency of the pop-up window, while greatly reducing the load on the back-end database, thereby reducing the consumption of server resources and reducing operating costs.
[0047] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0049] Figure 1 It is a flowchart of a pop-up window control method based on Redis provided in an embodiment of the present application;
[0050] Figure 2A , 2B This is a schematic diagram of a configuration interface for pop-up window configuration information provided in an embodiment of the present application;
[0051] Figure 3 It is a structural diagram of a pop-up window control device based on Redis provided in an embodiment of the present application;
[0052] Figure 4It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0053] The following description and the accompanying drawings sufficiently illustrate specific embodiments of the present application to enable those skilled in the art to practice them.
[0054] It should be clear that the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0055] When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.
[0056] In the description of the present application, it should be understood that the terms "first", "second", etc. are used for descriptive purposes only and should not be understood as indicating or implying relative importance. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to the specific circumstances. In addition, in the description of the present application, unless otherwise specified, "multiple" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship.
[0057] The present application provides a pop-up window control method, device, medium and electronic device based on Redis to solve the problems existing in the above-mentioned related technical problems. In an embodiment of the present application, the mapping relationship between the pop-up window identifier and the pop-up window data is stored in the Redis cache. The Redis has high-speed caching and data processing capabilities. Therefore, the pop-up window data of the target pop-up window is obtained from the Redis cache to realize the pop-up window control method, which can improve the response speed and processing efficiency of the pop-up window, and at the same time greatly reduce the load of the back-end database, thereby reducing the consumption of server resources and reducing operating costs. The following is a detailed description using an exemplary embodiment.
[0058] The following will be combined with the attached Figure 1 -Attached Figure 3, a pop-up window control method based on Redis provided in an embodiment of the present application is introduced in detail. The method can be implemented by a computer program and can be run on a pop-up window control device based on Redis based on the von Neumann system. The computer program can be integrated into an application or run as an independent tool application.
[0059] See also Figure 1 , provides a flow chart of a pop-up window control method based on Redis for the embodiment of the present application, which is applied to the server. Figure 1 As shown, the method of the embodiment of the present application may include the following steps:
[0060] S101, in response to an access request sent by a client, querying configuration information of each pop-up window pre-configured in the system, where the access request is used to access the homepage of the system;
[0061] The client refers to the device or software used by the user, such as a personal computer, mobile phone or browser, to initiate a network request. An access request is a request sent by the user's device or software to the server to obtain data or services. The system is the application that the user accesses. The configuration information of each pre-configured pop-up window is the parameters and rules for the pop-up window display set in advance in the system by the system administrator or developer. The configuration interface is as follows: Figure 2A and Figure 2B The home page is the first page that is displayed by default when a user accesses the application.
[0062] In some embodiments, a user sends an HTTP request to a server of an e-commerce website through a browser on a client, and the request is used to access the home page of the system. After receiving the request, the server responds to the specific content of the client's home page and queries the system for configuration information of each pop-up window pre-configured. The configuration information may specifically include the pop-up window number, pop-up window name, priority, pop-up window frequency (day, week, half month, month, quarter), total number of pop-up windows, number of pop-up windows per day, and user type (individual, enterprise).
[0063] S102, sorting the pop-up windows in order of priority according to the priority included in the configuration information of each pop-up window to obtain a pop-up window list;
[0064] Among them, priority refers to the order weight of pop-up window display. Pop-ups with higher priority will be displayed before pop-ups with lower priority.
[0065] In some embodiments of the present application, it is assumed that an online shopping platform has multiple pop-up windows, including promotional activity pop-up windows, user notification pop-up windows, and advertisement pop-up windows. The configuration information of these pop-up windows contains their respective priorities. When a user accesses the online shopping platform through a client, the server will sort these pop-up windows in descending order of priority according to the priority in the configuration information of the pop-up windows to form a pop-up window list.
[0066] S103, obtaining pop-up window data of a target pop-up window from a Redis cache; the Redis cache is used to store a mapping relationship between a pop-up window identifier and pop-up window data, the pop-up window data is used to represent historical display information of a target pop-up window, and the target pop-up window is each pop-up window obtained by traversing the pop-up window list;
[0067] Among them, Redis cache is an open source, high-performance key-value database, commonly used for caching and message queues. In this application, it is used to store data related to pop-ups to achieve fast read and write operations. The pop-up window data of the target pop-up window refers to the data associated with a specific pop-up window (target pop-up window), which is used to record and describe the historical display information of the pop-up window, such as the number of displays, the most recent display date, etc. The pop-up window identifier is used to uniquely identify the key of each pop-up window, so that data related to a specific pop-up window can be quickly located and retrieved in the Redis cache.
[0068] The access request carries a user ID, and the configuration information of each pop-up window includes the pop-up window ID.
[0069] In some embodiments of the present application, the specific process of obtaining the pop-up window data of the target pop-up window from the Redis cache includes: obtaining the pop-up window number of the target pop-up window; concatenating the pop-up window number of the target pop-up window with the user number to obtain a pop-up window identifier; and according to the pop-up window identifier, obtaining the corresponding pop-up window data from the mapping relationship as the pop-up window data of the target pop-up window.
[0070] The pop-up window number is a unique identifier for each pop-up window, which is used to distinguish different pop-ups. The user number is a unique identifier for each user, which is used to distinguish different users. The pop-up window identifier is a unique identifier formed by concatenating the pop-up window number and the user number of the target pop-up window. This identifier is used to accurately retrieve data associated with a specific user and a specific pop-up window in the Redis database. The mapping relationship refers to the key-value pair stored in the Redis database, where the key is the pop-up window identifier and the value is the corresponding pop-up window data.
[0071] For example, when user "user_12345" visits a news website, the server obtains the ID of the "Breaking News" pop-up window "news_alert_001" and concatenates it with the user's ID "user_12345" to form the pop-up window identifier "news_alert_001_user_12345". Then, the system retrieves the corresponding pop-up window data from the mapping relationship in the Redis database based on this pop-up window identifier.
[0072] The data format of the pop-up data is: {"latestDate":"yyyy-MM-dd","flags":"*,*,*"}, where latestDate is the target date of the last pop-up judgment, flags is the continuous pop-up detailed data, and * is the specific number of pop-ups on a certain day.
[0073] S104, based on the pop-up window data of the target pop-up window, controlling the target pop-up window to be displayed on the client.
[0074] In some embodiments of the present application, based on the pop-up window data of the target pop-up window, the specific process of controlling the target pop-up window to be displayed on the client includes: when the pop-up window data of the target pop-up window is empty, sending the target pop-up window to the client for display.
[0075] Furthermore, when the pop-up window data of the target pop-up window is empty, after the target pop-up window is sent to the client for display, it also specifically includes: obtaining the current date as the target date of the last pop-up window judgment; setting the number of pop-ups on the current date to 1, as the continuous pop-up window detail data; combining the target date of the last pop-up window judgment and the continuous pop-up window detail data into the final pop-up window data of the target pop-up window; and storing the mapping relationship between the pop-up window identifier and the final pop-up window data in the Redis cache.
[0076] For example, the final pop-up window data is {"latestDate":"yyyy-MM-dd","flags":"1"}.
[0077] Alternatively, when the pop-up data of the target pop-up window is not empty, obtain the target date of the last pop-up judgment and the continuous pop-up detail data from the pop-up data of the target pop-up window, and the continuous pop-up detail data is the number of pop-ups per day from the target date to the current date; based on the target date and the continuous pop-up detail data, control the target pop-up window to be displayed on the client.
[0078] In some embodiments of the present application, based on the target date and the continuous pop-up window detail data, the specific process of controlling the target pop-up window to be displayed on the client includes: determining whether the number of pop-up windows per day from the target date to the current date is missing; if so, using 0 to complete the number of pop-up windows for the missing date to obtain the final continuous pop-up window detail data; based on the pre-configured pop-up window frequency, calculating the number of days in the cycle, and the pre-configured pop-up window frequency is used to indicate the time interval for repeated display of the target pop-up window; according to the number of days in the cycle and the continuous pop-up window detail data, calculating the total number of pop-up windows on the current date and the number of pop-up windows on the day; based on the total number of pop-up windows and the number of pop-up windows on the day, controlling the target pop-up window to be displayed on the client.
[0079] For example, when a user visits the system homepage, the server will check whether the relevant pop-up data of the user already exists in Redis. These data include latestDate (the date of the last pop-up judgment) and flags (continuous pop-up details). If there is cached data in Redis, the server will retrieve the values of these two fields. latestDate indicates the date of the last pop-up judgment, and flags is a string that records the number of pop-ups per day from latestDate to the current date. The server needs to calculate the number of pop-ups for each day from latestDate to the current date. This calculation is to fill in the data that may be missing in flags and ensure that flags can reflect the pop-up situation of each day from latestDate to the current date. If there are missing days between latestDate and the current date, the server will set the number of pop-ups for these days to 0 to complete the flags data. For example, if latestDate is 2024-10-01, the current date is 2024-10-03, and there is only data for 2024-10-01 in flags, the server will fill in the number of pop-up windows for 2024-10-02 to 0.
[0080] For example, if a pop-up configuration requires "display 5 times a week", then the cycle days (days) is 7 days.
[0081] For example, if the configuration is "weekly", the cycle is 7 days. If flags is "2,0,1,0,0,0,1", it means that within the 7 days starting from latestDate, there were 2 pop-ups on the 1st day, 1 pop-up on the 3rd day, and 1 pop-up on the 7th day. If flags is "2,0,1,0,0,0,1", the total number of pop-ups is 2+0+1+0+0+0+1=4. If today is the 3rd day of the cycle, the 3rd number in flags is 0, so the number of pop-ups on that day is 0.
[0082] In some embodiments of the present application, based on the total number of pop-up windows and the number of pop-up windows on the day, the specific process of controlling the target pop-up window to be displayed on the client includes: when the number of pop-up windows on the day is less than the preset daily pop-up window number threshold and the total number of pop-up windows is less than the preset total pop-up window number threshold, sending the target pop-up window to the client for display; or, when the number of pop-up windows on the day is equal to the preset daily pop-up window number threshold or the total number of pop-up windows is equal to the preset total pop-up window number threshold, traversing the next target pop-up window in the pop-up window list.
[0083] Furthermore, when the number of pop-up windows on the day is less than the preset daily pop-up window number threshold and the total number of pop-up windows is less than the preset total pop-up window number threshold, after the target pop-up window is sent to the client for display, it also specifically includes: adding 1 to the number of pop-up windows on the day to update the number of pop-up windows on the day in the final continuous pop-up window detail data to obtain updated continuous pop-up window detail data; obtaining the current date as the target date for the last pop-up window judgment; combining the target date for the last pop-up window judgment with the updated continuous pop-up window detail data into the final pop-up window data; and storing the mapping relationship between the pop-up window identifier and the final pop-up window data in the Redis cache.
[0084] For example, a pop-up window configuration requires that it pops up twice a day for a week, for a total of 5 times.
[0085] Day 1, time 1: The redis storage data changes from null value to:
[0086] {"latestDate":"2024-10-01","flags":"1"}.
[0087] Day 1, second time: the redis storage data changes from the original value to the number of times on that day + 1, becoming:
[0088] {"latestDate":"2024-10-01","flags":"2"}.
[0089] Day 1, third time: Redis storage data judgment, pop-up window has appeared twice on that day, and no more pop-up window will appear on that day.
[0090] Day 3, time 1: The redis storage data changes from the original value to:
[0091] {"latestDate":"2024-10-03","flags":"2,0,0"};
[0092] Then after judging the pop-up window logic, it becomes:
[0093] {"latestDate":"2024-10-03","flags":"2,0,1"}.
[0094] The second time on the third day: the redis storage data changes from the original value to the number of times on that day + 1, and becomes:
[0095] {"latestDate":"2024-10-03","flags":"2,0,2"}.
[0096] Day 5, time 1: The redis storage data changes from the original value to:
[0097] {"latestDate":"2024-10-05","flags":"2,0,2,0,0"}.
[0098] Then after judging the pop-up window logic, it becomes:
[0099] {"latestDate":"2024-10-05","flags":"2,0,2,0,1"}.
[0100] The second time on the 5th day: judging by the redis storage data, the pop-up window has appeared 5 times within a week, and there will be no more pop-ups within a week.
[0101] In an embodiment of the present application, the mapping relationship between the pop-up identifier and the pop-up data is stored in the Redis cache. The Redis has high-speed caching and data processing capabilities. Therefore, the pop-up data of the target pop-up window is obtained from the Redis cache to implement the pop-up control method. This can improve the response speed and processing efficiency of the pop-up window, while greatly reducing the load on the back-end database, thereby reducing the consumption of server resources and reducing operating costs.
[0102] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0103] See also Figure 3 , which shows a schematic diagram of the structure of a pop-up window control device based on Redis provided by an exemplary embodiment of the present application. The pop-up window control device based on Redis can be implemented as all or part of an electronic device through software, hardware, or a combination of both. The device 1 includes a query module 10, a sorting module 20, an acquisition module 30, and a display module 40.
[0104] A query module 10, for querying the configuration information of each pop-up window pre-configured in the system in response to an access request sent by a client, wherein the access request is for accessing the homepage of the system;
[0105] A sorting module 20, used to sort the pop-up windows in order of priority according to the priority included in the configuration information of each pop-up window, to obtain a pop-up window list;
[0106] An acquisition module 30 is used to acquire pop-up window data of a target pop-up window from a Redis cache; the Redis cache is used to store a mapping relationship between a pop-up window identifier and pop-up window data, the pop-up window data is used to represent historical display information of a target pop-up window, and the target pop-up window is each pop-up window traversed from a pop-up window list;
[0107] The display module 40 is used to control the target pop-up window to be displayed on the client based on the pop-up window data of the target pop-up window.
[0108] It should be noted that the pop-up window control device based on Redis provided in the above embodiment only uses the division of the above-mentioned functional modules as an example when executing the pop-up window control method based on Redis. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the pop-up window control device based on Redis provided in the above embodiment and the pop-up window control method embodiment based on Redis belong to the same concept. The implementation process is detailed in the method embodiment, which will not be repeated here.
[0109] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0110] In an embodiment of the present application, the mapping relationship between the pop-up identifier and the pop-up data is stored in the Redis cache. The Redis has high-speed caching and data processing capabilities. Therefore, the pop-up data of the target pop-up window is obtained from the Redis cache to implement the pop-up control method. This can improve the response speed and processing efficiency of the pop-up window, while greatly reducing the load on the back-end database, thereby reducing the consumption of server resources and reducing operating costs.
[0111] The present application also provides a computer-readable medium on which program instructions are stored. When the program instructions are executed by a processor, the Redis-based pop-up window control method provided by the above-mentioned various method embodiments is implemented.
[0112] The present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute the Redis-based pop-up window control method of each of the above method embodiments.
[0113] See also Figure 4 , is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 4 As shown, the electronic device 1000 may include: at least one processor 1001 , at least one network interface 1004 , a user interface 1003 , a memory 1005 , and at least one communication bus 1002 .
[0114] The communication bus 1002 is used to realize the connection and communication between these components.
[0115] The user interface 1003 may include a display screen (Display) and a camera (Camera), and the optional user interface 1003 may also include a standard wired interface and a wireless interface.
[0116] The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).
[0117] Among them, the processor 1001 may include one or more processing cores. The processor 1001 uses various interfaces and lines to connect various parts within the entire electronic device 1000, and executes various functions and processes data of the electronic device 1000 by running or executing instructions, programs, code sets or instruction sets stored in the memory 1005, and calling data stored in the memory 1005. Optionally, the processor 1001 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 1001 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 1001, and it can be implemented separately through a chip.
[0118] Among them, the memory 1005 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory). Optionally, the memory 1005 includes a non-transitory computer-readable storage medium. The memory 1005 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 1005 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 1005 may also be optionally at least one storage system located away from the aforementioned processor 1001. As Figure 4 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a Redis-based pop-up control application.
[0119] exist Figure 4 In the electronic device 1000 shown, the user interface 1003 is mainly used to provide an input interface for the user and obtain the data input by the user; and the processor 1001 can be used to call the Redis-based pop-up control application stored in the memory 1005, and specifically perform the following operations:
[0120] In response to an access request sent by a client, query the configuration information of each pop-up window pre-configured in the system, where the access request is used to access the homepage of the system;
[0121] According to the priority included in the configuration information of each pop-up window, the pop-up windows are sorted in order of priority to obtain a pop-up window list;
[0122] Obtain the pop-up window data of the target pop-up window from the Redis cache; the Redis cache is used to store the mapping relationship between the pop-up window identifier and the pop-up window data, and the pop-up window data is used to represent the historical display information of the target pop-up window. The target pop-up window is each pop-up window traversed from the pop-up window list;
[0123] Based on the pop-up window data of the target pop-up window, control the display of the target pop-up window on the client.
[0124] In one embodiment, when the processor 1001 obtains the pop-up window data of the target pop-up window from the Redis cache, the following operations are specifically performed:
[0125] Get the pop-up window ID of the target pop-up window;
[0126] Concatenate the pop-up window ID of the target pop-up window with the user ID to obtain a pop-up window identifier;
[0127] According to the pop-up window identifier, the corresponding pop-up window data is obtained from the mapping relationship as the pop-up window data of the target pop-up window.
[0128] In one embodiment, when the processor 1001 executes the pop-up window data based on the target pop-up window and controls the target pop-up window to be displayed on the client, the processor 1001 specifically performs the following operations:
[0129] When the pop-up window data of the target pop-up window is empty, the target pop-up window is sent to the client for display; or,
[0130] When the pop-up window data of the target pop-up window is not empty, the target date of the last pop-up window judgment and the continuous pop-up window details are obtained from the pop-up window data of the target pop-up window. The continuous pop-up window details are the number of pop-ups per day from the target date to the current date.
[0131] Based on the target date and the continuous pop-up window details, control the display of the target pop-up window on the client.
[0132] In one embodiment, when the processor 1001 controls the target pop-up window to be displayed on the client based on the target date and the continuous pop-up window details, the processor 1001 specifically performs the following operations:
[0133] Determine whether the number of pop-up windows per day from the target date to the current date is missing;
[0134] If yes, use 0 to fill in the missing pop-up window times for the date to get the final continuous pop-up window details;
[0135] The number of days of the cycle is calculated based on the pre-configured pop-up frequency, where the pre-configured pop-up frequency is used to indicate the time interval for repeated display of the target pop-up;
[0136] According to the cycle days and the continuous pop-up details, calculate the total number of pop-ups on the current date and the number of pop-ups on the day;
[0137] Based on the total number of pop-up windows and the number of pop-up windows on the day, control the display of target pop-up windows on the client.
[0138] In one embodiment, when the processor 1001 controls the target pop-up window to be displayed on the client based on the total number of pop-up windows and the number of pop-up windows on the day, the processor 1001 specifically performs the following operations:
[0139] When the number of pop-up windows on the day is less than the preset daily pop-up window number threshold and the total number of pop-up windows is less than the preset total pop-up window number threshold, the target pop-up window is sent to the client for display; or,
[0140] When the number of pop-up windows on the day is equal to the preset daily pop-up window number threshold or the total number of pop-up windows is equal to the preset total number of pop-up windows threshold, traverse the next target pop-up window in the pop-up window list.
[0141] In one embodiment, after sending the target pop-up window to the client for display when the pop-up window data of the target pop-up window is empty, the processor 1001 further performs the following operations:
[0142] Get the current date as the target date for the last pop-up judgment;
[0143] Set the number of pop-up windows for the current date to 1 as the continuous pop-up window details;
[0144] Combine the target date of the last pop-up window judgment with the continuous pop-up window details data to form the final pop-up window data of the target pop-up window;
[0145] The mapping relationship between the pop-up window identifier and the final pop-up window data is stored in the Redis cache.
[0146] In one embodiment, after the processor 1001 sends the target pop-up window to the client for display when the number of pop-up windows on the day is less than the preset daily pop-up window number threshold and the total number of pop-up windows is less than the preset total number of pop-up windows threshold, it further performs the following operations:
[0147] The number of pop-up windows on the day is increased by 1 to update the number of pop-up windows on the day in the final continuous pop-up window detail data to obtain the updated continuous pop-up window detail data;
[0148] Get the current date as the target date for the last pop-up judgment;
[0149] Combine the target date of the last pop-up window judgment with the updated continuous pop-up window detail data to form the final pop-up window data;
[0150] The mapping relationship between the pop-up window identifier and the final pop-up window data is stored in the Redis cache.
[0151] In an embodiment of the present application, the mapping relationship between the pop-up identifier and the pop-up data is stored in the Redis cache. The Redis has high-speed caching and data processing capabilities. Therefore, the pop-up data of the target pop-up window is obtained from the Redis cache to implement the pop-up control method. This can improve the response speed and processing efficiency of the pop-up window, while greatly reducing the load on the back-end database, thereby reducing the consumption of server resources and reducing operating costs.
[0152] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program for pop-up window control based on Redis can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium of the program for pop-up window control based on Redis can be a disk, an optical disk, a read-only storage memory, or a random access memory, etc.
[0153] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A pop-up window control method based on Redis, characterized in that: Applied to the server, the method includes: In response to an access request sent by a client, querying configuration information of each pop-up window pre-configured in the system, wherein the access request is used to access the homepage of the system; According to the priorities included in the configuration information of each pop-up window, the pop-up windows are sorted in order of priority to obtain a pop-up window list; Obtaining pop-up window data of a target pop-up window from a Redis cache; the Redis cache is used to store a mapping relationship between a pop-up window identifier and pop-up window data, the pop-up window data is used to characterize historical display information of the target pop-up window, and the target pop-up window is each pop-up window traversed from the pop-up window list; Based on the pop-up window data of the target pop-up window, the target pop-up window is controlled to be displayed on the client.
2. The method according to claim 1, characterized in that: The access request carries a user number, and the configuration information of each pop-up window includes a pop-up window number; The step of obtaining the pop-up window data of the target pop-up window from the Redis cache includes: Obtain the pop-up window number of the target pop-up window; Concatenate the pop-up window number of the target pop-up window with the user number to obtain a pop-up window identifier; According to the pop-up window identifier, corresponding pop-up window data is obtained from the mapping relationship as the pop-up window data of the target pop-up window.
3. The method according to claim 2, characterized in that The controlling the target pop-up window to be displayed on the client based on the pop-up window data of the target pop-up window includes: When the pop-up window data of the target pop-up window is empty, the target pop-up window is sent to the client for display; or, When the pop-up window data of the target pop-up window is not empty, the target date of the last pop-up window judgment and the continuous pop-up window detail data are obtained from the pop-up window data of the target pop-up window, and the continuous pop-up window detail data is the number of pop-ups per day from the target date to the current date; Based on the target date and the continuous pop-up window detail data, the target pop-up window is controlled to be displayed on the client.
4. The method according to claim 3, characterized in that The controlling the target pop-up window to be displayed on the client based on the target date and the continuous pop-up window detail data includes: Determine whether the number of pop-up windows per day from the target date to the current date is missing; If yes, use 0 to fill in the missing pop-up window times for the date to get the final continuous pop-up window details; Calculate the number of days of the cycle based on a pre-configured pop-up window frequency, where the pre-configured pop-up window frequency is used to indicate the time interval for repeated display of the target pop-up window; Calculate the total number of pop-up windows on the current date and the number of pop-up windows on the current day according to the number of days in the cycle and the continuous pop-up window details; Based on the total number of pop-up windows and the number of pop-up windows on the day, the target pop-up window is controlled to be displayed on the client.
5. The method according to claim 4, characterized in that The controlling the target pop-up window to be displayed on the client based on the total number of pop-up windows and the number of pop-up windows on the day includes: When the number of pop-up windows on the day is less than the preset daily pop-up window number threshold and the total number of pop-up windows is less than the preset total number of pop-up windows threshold, the target pop-up window is sent to the client for display; or When the number of pop-up windows on the day is equal to the preset daily pop-up window number threshold or the total number of pop-up windows is equal to the preset total number of pop-up windows threshold, traverse the next target pop-up window in the pop-up window list.
6. The method according to claim 3, characterized in that When the pop-up window data of the target pop-up window is empty, after sending the target pop-up window to the client for display, the method further includes: Get the current date as the target date for the last pop-up judgment; Set the number of pop-up windows for the current date to 1 as the continuous pop-up window details; The target date of the last pop-up window judgment and the continuous pop-up window detail data are combined into the final pop-up window data of the target pop-up window; The mapping relationship between the pop-up window identifier and the final pop-up window data is stored in the Redis cache.
7. The method according to claim 5, characterized in that When the number of pop-up windows on the day is less than the preset daily pop-up window number threshold and the total number of pop-up windows is less than the preset total number of pop-up windows threshold, after sending the target pop-up window to the client for display, the method further includes: The number of pop-up windows on the day is increased by 1 to update the number of pop-up windows on the day in the final continuous pop-up window detailed data to obtain updated continuous pop-up window detailed data; Get the current date as the target date for the last pop-up judgment; Combine the target date of the last pop-up window judgment with the updated continuous pop-up window detail data to form the final pop-up window data; The mapping relationship between the pop-up window identifier and the final pop-up window data is stored in the Redis cache.
8. A pop-up window control device based on Redis, characterized in that: The device comprises: A query module, used to query the configuration information of each pop-up window pre-configured in the system in response to an access request sent by a client, wherein the access request is used to access the homepage of the system; A sorting module, used to sort the pop-up windows in order of priority according to the priority included in the configuration information of the pop-up windows, to obtain a pop-up window list; An acquisition module, used to acquire pop-up window data of a target pop-up window from a Redis cache; the Redis cache is used to store a mapping relationship between a pop-up window identifier and pop-up window data, the pop-up window data is used to characterize historical display information of the target pop-up window, and the target pop-up window is each pop-up window traversed from the pop-up window list; A display module is used to control the target pop-up window to be displayed on the client based on the pop-up window data of the target pop-up window.
9. A computer storage medium, characterized in that: The computer storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the method according to any one of claims 1 to 7.
10. An electronic device, characterized in that: include: A processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the method according to any one of claims 1 to 7.