CN-116088766-B - Sign-in data compression storage method, computing device and storage medium
Abstract
The invention discloses a check-in data compression storage method, computing equipment and storage medium, which are suitable for storing check-in state data based on a check-in data structure, wherein the check-in data structure comprises a first data area and a second data area, each of the first data area and the second data area comprises a plurality of bits, each bit is suitable for recording one-day check-in state data, the method comprises the steps of responding to a check-in request of a date to be checked-in, determining a check-in type corresponding to the check-in request, determining a target data area corresponding to the check-in type, wherein a first data area corresponds to a normal check-in, a second data area corresponds to a check-in, recording the checked-in state data to corresponding bits of the target data area according to the date to be checked-in, and generating and storing check-in state fields according to the check-in state data recorded by all bits in the first data area and the second data area of the check-in data structure. According to the technical scheme, the order of magnitude of the check-in data storage is effectively reduced, and the check-in data storage and query performance is improved.
Inventors
- LIU YU
Assignees
- 车智互联(北京)科技有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20230207
Claims (6)
- 1. A check-in data compression storage method executed in a computing device, storing check-in status data based on a check-in data structure, the check-in data structure including a first data area and a second data area, the first data area being a low-bit data area, the second data area being a high-bit data area, the first data area, the second data area respectively including N bits, each bit respectively adapted to record one day of check-in status data, wherein N >31 so as to record one day of check-in status data including check-in status data, check-out status data, wherein each bit is adapted to represent a check-in status and a check-out status respectively as check-in status data, and check-out status data with 1 and 0, respectively, the method comprising: responding to a check-in request of a date to be checked-in, and determining a check-in type corresponding to the check-in request, wherein the check-in type comprises normal check-in and check-in; Determining a target data area corresponding to the check-in type, wherein the normal check-in corresponds to a first data area and the check-in corresponds to a second data area; recording the checked-in state data to the corresponding bit of the target data area according to the to-be-checked-in date comprises recording the checked-in state data to the corresponding bit of the first data area according to the to-be-checked-in date if the checked-in type is normal check-in, and recording the checked-in state data to the corresponding bit of the second data area according to the to-be-checked-in date if the checked-in type is patch check-in; Performing bit operation on the daily sign-in state data in one month recorded in all bits in a first data area and a second data area of the sign-in data structure to obtain a month sign-in state field corresponding to the month and storing the month sign-in state field; Generating user sign-in data corresponding to the user identification according to the user identification and a month sign-in status field corresponding to each month in the year to which the sign-in belongs and storing the user sign-in data; the method comprises the steps of responding to a request for obtaining sign-in state information of a specified date, obtaining a month sign-in state field of a user in a corresponding month according to the user identification and the specified date, generating sign-in state data of each day in the corresponding month according to the month sign-in state field, determining the sign-in state and sign-in type of the specified date according to the sign-in state data of each day in the corresponding month, and returning.
- 2. The method of claim 1, wherein recording checked-in status data to corresponding bits of the target data area according to the check-in date comprises: And setting bit data corresponding to the date to be checked in the target data area to be 1 so as to represent the checked in state.
- 3. The method of claim 1, further comprising: Responding to a request for acquiring the continuous check-in days of the month in which the appointed date is, and acquiring a month check-in status field of the corresponding month according to the appointed date; generating sign-in state data of each day in the corresponding month according to the month sign-in state field; And determining the continuous check-in days of the month according to the daily check-in state data in the corresponding month and returning.
- 4. A method as claimed in any one of claims 1 to 3, wherein the first and second data regions each comprise 32 bits.
- 5. A computing device, comprising: At least one processor, and A memory storing program instructions, wherein the program instructions are configured to be adapted to be executed by the at least one processor, the program instructions comprising instructions for performing the method of any of claims 1-4.
- 6. A readable storage medium storing program instructions which, when read and executed by a computing device, cause the computing device to perform the method of any of claims 1-4.
Description
Sign-in data compression storage method, computing device and storage medium Technical Field The present invention relates to the field of computers and internet technologies, and in particular, to a check-in data compression storage method, a computing device and a storage medium. Background With the development of the internet, internet applications are continuously penetrated into people's daily lives. In order to keep the daily living users, the large internet platforms are all clear, and the check-in activities are one of operation means for improving the viscosity of the daily living users. The better the check-in activity effect is, the more participating users are indicated, which means that the user check-in data required to be recorded and processed by the background system is more and more huge. With the rapid increase of the check-in data volume, the problems of increased storage overhead, long system inquiry performance consumption and the like are caused. A common storage scheme for check-in data in the prior art is to record check-in behavior of a user every day as a record unit. Namely, the check-in data of the same user on the same day can record 1 piece of corresponding information in the system. Each piece of check-in data generally includes basic information such as a user ID, a check-in date (accurate check-in day), a check-in status identification (0-check-in; 1-check-in), a tab identification (0-normal check-in; 1-tab), and the like. Tab identification is typically used to support data support for tab requirements that may be provided in a check-in activity. According to the storage scheme, if the check-in data of a given user on a certain day needs to be cleared, the system needs to set the check-in state in the piece of data to be 0-unset according to the given user ID and the given check-in date, and if the check-in data of the user ID on a certain day is not found, the check-in data is uniformly regarded as the user not checked in on the certain day. When the sign-in data is needed to be used later, the system processes the sign-in information meeting the conditions according to the appointed user ID and the sign-in date range and returns to the foreground. If the display is to be distinguished from the display of the tab, the system is required to return the corresponding data according to the tab identifier. In addition, the current continuous check-in days are calculated by traversing the check-in data to count the days in the corresponding month. According to the existing check-in data storage scheme, the required check-in data volume is overlarge, the check-in data required by the system is proportional to the check-in behavior of the user, and when the check-in behavior of the user increases, the check-in data required by the system also increases. For example, a user participating in check-in for 2 months has 1 ten thousand people, and every person checks in for 15 days on average, and then the check-in data for 2 months of the system needs 15 ten thousand records. In addition, according to the existing storage scheme, since each check-in action of each user is stored according to 1 piece of check-in data, if concurrent processing is not considered, multiple pieces of check-in data of the same user on the same day may occur, and calculation of subsequent continuous check-in days may be affected, so when the check-in data is stored, the situation of concurrent processing needs to be considered, and code complexity may be increased. In addition, according to the existing storage scheme, when calculating the number of continuous check-in days, all check-in data of a user are required to be screened out first, then all check-in data are cycled, and after the comparison with the date of the check-in behavior is passed, counting is performed. When the number of check-in data increases, the time for traversing the data correspondingly increases, which results in a larger algorithm logic performance overhead for calculating the number of continuous check-in days of the user. In addition, the storage scheme based on the cache in the prior art also has the problem of overlarge data volume and risk of data loss. Therefore, a check-in data compression storage method is needed to solve the problems in the above technical solutions. Disclosure of Invention Accordingly, the present invention provides a check-in data compression storage method to solve or at least alleviate the above-identified problems. According to one aspect of the invention, a check-in data compression storage method is provided, which is executed in a computing device and is suitable for storing check-in state data based on a check-in data structure, wherein the check-in data structure comprises a first data area and a second data area, each bit comprises a plurality of bits, each bit is suitable for recording one day of check-in state data, each bit comprises check-in state data and check-out state data, the method c