Check-in data compression storage method, computing device and storage medium
By dividing the sign-in data structure into low-order and high-order data areas, recording the sign-in status bit by bit, and generating a sign-in status field for storage, the problems of large data storage volume and low query performance of sign-in data are solved, achieving efficient data storage and query.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHEZHI HULIAN BEIJING SCI & TECH CO LTD
- Filing Date
- 2023-02-07
- Publication Date
- 2026-05-08
AI Technical Summary
Existing sign-in data storage solutions result in excessively large data volumes, long system query times, and high complexity in concurrent processing, as well as the risk of data loss.
A sign-in data compression storage method is adopted, and the sign-in data structure is redefined. The data is divided into low-bit data area and high-bit data area to record normal sign-in and supplementary sign-in status data respectively. Each data area occupies multiple bits, and the sign-in status data for each day is recorded bit by bit. Bit operations are used to generate a sign-in status field for storage.
It effectively reduced the order of magnitude of data storage for check-in, improved storage and query performance, reduced the complexity of data processing in concurrent scenarios, and ensured data accuracy.
Smart Images

Figure CN116088766B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of computer and Internet technology, and in particular to a method for compressing and storing check-in data, a computing device, and a storage medium. Background Technology
[0002] With the development of the internet, internet applications have increasingly permeated people's daily lives. Major internet platforms employ various methods to retain daily active users (DAU), and check-in activities are one such operational strategy to improve DAU engagement. Generally, the better the check-in activity, the more users participate, which also means a larger volume of user check-in data that the backend system needs to record and process.
[0003] As the amount of sign-in data increases rapidly, it can lead to problems such as increased storage overhead and longer system query times.
[0004] The common storage scheme for check-in data in existing technologies records check-in data on a per-day basis. That is, for the same user, check-in data for the same day is recorded as one entry in the system. Each check-in entry typically includes basic information such as user ID, check-in date (accurate to the day), check-in status (0 - not checked in; 1 - checked in), and make-up check-in flag (0 - normal check-in; 1 - make-up check-in). The make-up check-in flag is generally used to support data support for make-up check-in requests that may be made during check-in activities. According to the above storage scheme, if it is necessary to clear the check-in data for a specific user on a specific day, the system needs to set the check-in status of that entry to 0 (not checked in) based on the specified user ID and check-in date; if no check-in data for that user ID on a specific day is found, it is considered that the user did not check in on that day. When check-in data is needed subsequently, the system processes the check-in information that meets the conditions based on the specified user ID and check-in date range, and then returns it to the front end. If it is necessary to distinguish which day is a make-up check-in, the system needs to return the corresponding data based on the make-up check-in flag. In addition, the calculation of the current consecutive check-in days needs to be done by iterating through the check-in data to count the number of days in the corresponding month.
[0005] The existing sign-in data storage scheme results in an excessively large volume of sign-in data. The required data is directly proportional to user sign-in activity; as user sign-in activity increases, the required data volume also increases. For example, if 10,000 users participated in sign-in in February, with an average of 15 days per user, the system would need to record 150,000 sign-in entries for February. Furthermore, the existing storage scheme stores each user's sign-in activity as a single entry. Without considering concurrency, multiple entries for the same user on the same day could appear, affecting the calculation of subsequent consecutive sign-in days. Therefore, concurrency must be considered when storing sign-in data, inevitably increasing code complexity. Additionally, the existing storage scheme requires filtering all user sign-in data, iterating through all entries, comparing each entry with the corresponding date, and then counting. As the amount of check-in data increases, the time required to traverse the data also increases accordingly, which leads to a large performance overhead in the algorithm logic for calculating the number of consecutive check-in days for users.
[0006] In addition, existing caching-based storage solutions also suffer from problems such as excessive data volume and the risk of data loss.
[0007] Therefore, a method for compressing and storing check-in data is needed to solve the problems existing in the above technical solutions. Summary of the Invention
[0008] Therefore, the present invention provides a method for compressing and storing check-in data to solve or at least alleviate the problems mentioned above.
[0009] According to one aspect of the present invention, a method for compressed storage of check-in data is provided, executed in a computing device, suitable for 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 and the second data area each including multiple bits, each bit being adapted to record check-in status data for one day, the check-in status data including checked-in status data and unchecked-in status data; the method includes: in response to a check-in request for a date to be checked in, determining a check-in type corresponding to the check-in request, the check-in type including normal check-in and make-up check-in; determining a target data area corresponding to the check-in type, wherein normal check-in corresponds to the first data area and make-up check-in corresponds to the second data area; recording the checked-in status data into the corresponding bit of the target data area according to the date to be checked in; generating and storing a check-in status field based on the check-in status data recorded in all bits of the first data area and the second data area of the check-in data structure.
[0010] Optionally, in the check-in data compression and storage method according to the present invention, recording the checked-in status data into the corresponding position of the target data area according to the check-in date includes: if the check-in type is normal check-in, then recording the checked-in status data into the corresponding position of the first data area according to the check-in date; if the check-in type is supplementary check-in, then recording the checked-in status data into the corresponding position of the second data area according to the check-in date.
[0011] Optionally, in the check-in data compression and storage method according to the present invention, recording the checked-in status data into the corresponding bit of the target data area according to the check-in date includes: setting the bit data in the target data area corresponding to the check-in date to 1 to indicate the checked-in status.
[0012] Optionally, in the check-in data compression and storage method according to the present invention, generating and storing a check-in status field based on the check-in status data of all bit records in the first data area and the second data area of the check-in data structure includes: performing bit operations on the check-in status data of all bit records in the first data area and the second data area of the check-in data structure to obtain and store the check-in status field.
[0013] Optionally, in the check-in data compression and storage method according to the present invention, the first data area and the second data area each include N bits, where N > 31, so as to record the check-in status data for each day within a month.
[0014] Optionally, in the check-in data compression and storage method according to the present invention, generating and storing a check-in status field based on the check-in status data of all bit records in the first data area and the second data area of the check-in data structure includes: generating and storing a monthly check-in status field corresponding to the month based on the daily check-in status data recorded in the first data area and the second data area of the check-in data structure within a month.
[0015] Optionally, the check-in data compression and storage method according to the present invention further includes: generating and storing user check-in data corresponding to the user identifier based on the user identifier and the monthly check-in status field corresponding to each month of the year to which the check-in belongs.
[0016] Optionally, the check-in data compression and storage method according to the present invention further includes: in response to a request to obtain check-in status information for a specified date, obtaining a monthly check-in status field for the corresponding month based on the specified date; generating daily check-in status data for the corresponding month based on the monthly check-in status field; determining the check-in status and check-in type for the specified date based on the daily check-in status data for the corresponding month and returning the result.
[0017] Optionally, in the check-in data compression and storage method according to the present invention, the request to obtain check-in status information for a specified date includes a user identifier; obtaining the monthly check-in status field for the corresponding month based on the specified date includes: obtaining the user's monthly check-in status field for the corresponding month based on the user identifier and the specified date.
[0018] Optionally, the check-in data compression and storage method according to the present invention further includes: in response to a request to obtain the number of consecutive check-in days in the month containing a specified date, obtaining the monthly check-in status field of the corresponding month according to the specified date; generating daily check-in status data for the corresponding month according to the monthly check-in status field; determining the number of consecutive check-in days in the month according to the daily check-in status data in the corresponding month and returning it.
[0019] Optionally, in the check-in data compression and storage method according to the present invention, the first data area and the second data area each include 32 bits.
[0020] Optionally, in the check-in data compression and storage method according to the present invention, the first data area is the low-order data area and the second data area is the high-order data area.
[0021] According to one aspect of the present invention, a computing device is provided, comprising: at least one processor; and a memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, the program instructions including instructions for performing the check-in data compression and storage method as described above.
[0022] According to one aspect of the present invention, a readable storage medium storing program instructions is provided, which, when read and executed by a computing device, causes the computing device to perform the check-in data compression storage method as described above.
[0023] According to the technical solution of the present invention, a method for compressing and storing check-in data is provided. The check-in data structure is redefined, dividing the data into a low-byte data area and a high-byte data area, used to record normal check-in status data and supplementary check-in status data respectively. Each data area occupies multiple bits (e.g., 32 bits), and daily check-in status data is recorded bit by bit. This allows for recording a user's daily check-in status data for a month based on the check-in data structure. Specifically, when a user's check-in request is received, the check-in type is first determined as either normal or supplementary check-in. Based on the check-in date, the already recorded check-in status data is recorded in the corresponding bit of the corresponding data area. Furthermore, the check-in status data recorded in all bits of the check-in data structure is calculated to form a single check-in status field for storage. Thus, the present invention can compress a user's monthly check-in status data into a single field for storage, effectively reducing the order of magnitude of check-in data storage and improving the performance of check-in data storage and retrieval. Furthermore, according to the check-in data compression and storage scheme of the present invention, check-in status data can be stored and updated bit by bit. Users' concurrent saving and updating of check-in status data will not affect the correctness of the final data, thereby reducing the data processing complexity in concurrent scenarios.
[0024] Furthermore, this invention utilizes bitwise operations to store 12 check-in fields for the same user within a year, thereby reducing the complexity of calculating consecutive check-in days.
[0025] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description
[0026] To achieve the foregoing and related objectives, certain illustrative aspects are described herein in conjunction with the following description and accompanying drawings. These aspects indicate various ways in which the principles disclosed herein may be practiced, and all aspects and their equivalents are intended to fall within the scope of the claimed subject matter. The foregoing and other objectives, features, and advantages of this disclosure will become more apparent from the following detailed description, taken in conjunction with the accompanying drawings. Throughout this disclosure, the same reference numerals generally refer to the same parts or elements.
[0027] Figure 1 A schematic diagram of a computing device 100 according to an embodiment of the present invention is shown;
[0028] Figure 2 A flowchart illustrating a check-in data compression and storage method 200 according to an embodiment of the present invention is shown;
[0029] Figure 3A schematic diagram of the check-in data structure according to an embodiment of the present invention is shown;
[0030] Figure 4 A schematic diagram of user check-in data storage according to an embodiment of the present invention is shown. Detailed Implementation
[0031] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
[0032] Figure 1 A schematic diagram of a computing device 100 according to an embodiment of the present invention is shown. Figure 1 As shown, in a basic configuration, computing device 100 includes at least one processing unit 102 and system memory 104. According to one aspect, depending on the configuration and type of the computing device, the processing unit 102 may be implemented as a processor. System memory 104 includes, but is not limited to, volatile memory (e.g., random access memory), non-volatile memory (e.g., read-only memory), flash memory, or any combination of such memories. According to one aspect, system memory 104 includes an operating system 105.
[0033] According to one aspect, operating system 105 is, for example, suitable for controlling the operation of computing device 100. Furthermore, examples are practiced in conjunction with graphics libraries, other operating systems, or any other applications, and are not limited to any particular application or system. Figure 1 The basic configuration is illustrated by the components within the dashed lines. According to one aspect, the computing device 100 has additional features or functions. For example, according to one aspect, the computing device 100 includes additional data storage devices (removable and / or non-removable), such as disks, optical discs, or magnetic tapes. This additional storage... Figure 1 The middle part is shown by removable storage device 109 and non-removable storage device 110.
[0034] As stated above, according to one aspect, program module 103 is stored in system memory 104. According to one aspect, program module 103 may include one or more applications. The present invention does not limit the type of application; for example, applications may include: email and contact applications, word processing applications, spreadsheet applications, database applications, slideshow applications, drawing or computer-aided applications, web browser applications, etc.
[0035] According to one aspect, program module 103 includes multiple program instructions suitable for executing the sign-in data compression and storage method 200 of the present invention, so as to reduce the order of magnitude of sign-in data storage and improve sign-in data storage and query performance by executing the sign-in data compression and storage method 200 of the present invention.
[0036] According to one aspect, examples can be practiced on circuits including discrete electronic components, packaged or integrated electronic chips containing logic gates, circuits utilizing microprocessors, or on a single chip containing electronic components or a microprocessor. For example, it can be practiced via wherein... Figure 1 Each or many of the components shown can be implemented as an example by integrating a System-on-a-Chip (SOC) on a single integrated circuit. According to one aspect, such an SOC device may include one or more processing units, graphics units, communication units, system virtualization units, and various application functions, all integrated (or “burned in”) as a single integrated circuit onto a chip substrate. When operating via the SOC, the functions described herein can be operated via dedicated logic integrated on a single integrated circuit (chip) with other components of the computing device 100. Embodiments of the invention can also be implemented using other techniques capable of performing logical operations (e.g., AND, OR, and NOT), including but not limited to mechanical, optical, fluid, and quantum technologies. Additionally, embodiments of the invention can be implemented within a general-purpose computer or in any other circuit or system.
[0037] According to one aspect, computing device 100 may also have one or more input devices 112, such as a keyboard, mouse, pen, voice input device, touch input device, etc. It may also include output devices 114, such as a display, speaker, printer, etc. The foregoing devices are examples and other devices may also be used. Computing device 100 may include one or more communication connections 116 that allow communication with other computing devices 118. Examples of suitable communication connections 116 include, but are not limited to: RF transmitter, receiver and / or transceiver circuitry; Universal Serial Bus (USB), parallel and / or serial ports.
[0038] As used herein, the term computer-readable medium includes computer storage medium. Computer storage medium can include volatile and non-volatile, removable and non-removable media implemented using any method or technology for storing information (e.g., computer-readable instructions, data structures, or program module 103). System memory 104, removable storage device 109, and non-removable storage device 110 are examples of computer storage media (i.e., memory storage). Computer storage media can include random access memory (RAM), read-only memory (ROM), electrically erasable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical storage, magnetic tape, magnetic tape, disk storage or other magnetic storage devices, or any other article of manufacture that can be used to store information and is accessible by computing device 100. According to one aspect, any such computer storage medium can be part of computing device 100. Computer storage media does not include carrier waves or other transmitted data signals.
[0039] According to one aspect, the communication medium is implemented by computer-readable instructions, data structures, program modules 103, or other data in a modulated data signal (e.g., a carrier wave or other transmission mechanism), and includes any information transmission medium. According to one aspect, the term "modulated data signal" describes a signal having one or more sets of characteristics or altered in a manner that encodes information in the signal. By way of example and not limitation, the communication medium includes wired media such as wired networks or direct wired connections, and wireless media such as acoustic, radio frequency (RF), infrared, and other wireless media.
[0040] In an embodiment of the present invention, a computing device 100 is configured to execute a sign-in data compression and storage method 200 according to the present invention. The computing device 100 includes one or more processors and one or more readable storage media storing program instructions. When the program instructions are configured to be executed by the one or more processors, the computing device executes the sign-in data compression and storage method 200 of the present invention, so as to reduce the order of magnitude of sign-in data storage and improve sign-in data storage and retrieval performance by executing the sign-in data compression and storage method 200 of the present invention.
[0041] Figure 2 A flowchart illustrating a check-in data compression and storage method 200 according to an embodiment of the present invention is shown. Method 200 is adapted to be executed in a computing device (e.g., the aforementioned computing device 100).
[0042] In embodiments of the present invention, a new check-in data structure for storing user check-in status data is constructed. Specifically, the check-in data structure is built based on binary and includes a first data area and a second data area. The first and second data areas can be used to record check-in data of different check-in types to distinguish user check-in data of different types. The first and second data areas each include multiple bits (binary bits), each of which is used to record check-in status data for one day. Thus, each data area can be used to record check-in status data for multiple days.
[0043] It should be noted that the check-in status data includes both checked-in and unchecked-in status data. Each bit in the binary data can support two data states. Thus, each bit in the first and second data areas can be represented by 1 and 0 respectively to indicate the checked-in and unchecked-in statuses. That is, each bit in each data area can use 1 to represent the checked-in status and 0 to represent the unchecked-in status.
[0044] like Figure 2 As shown, method 200 begins with step 210.
[0045] First, in step 210, when a user's check-in behavior based on the check-in date is received, the check-in type corresponding to the check-in request is determined in response to the user's check-in request for the check-in date.
[0046] Here, the check-in types include normal check-in and make-up check-in. That is, a user can perform a normal check-in (a check-in based on the current date) on the same day, or they can perform a make-up check-in for a previous date. In embodiments of the present invention, check-in data for different check-in types can be stored in different data areas. For example, check-in data for normal check-ins can be stored in the first data area, and check-in data for make-up check-ins can be stored in the second data area.
[0047] Subsequently, in step 220, the target data area corresponding to the check-in type is determined. Here, as mentioned above, normal check-in corresponds to the first data area, and supplementary check-in corresponds to the second data area.
[0048] Next, in step 230, the signed-in status data is recorded in the corresponding bit of the target data area (i.e., the binary bit corresponding to the signed-in date) according to the date to be checked in. In other words, the signed-in status data is recorded in the binary bit of the target data area corresponding to the date to be checked in.
[0049] Specifically, the bit data in the target data area corresponding to the check-in date is set to 1 to indicate a checked-in status. Correspondingly, the bit data corresponding to the unchecked status is 0. Here, the initial data for each bit in each data area is 0.
[0050] Furthermore, the check-in type can be determined based on whether the check-in date is the current day. If the check-in date is the current day and the check-in type is normal check-in, then in step 230, according to the check-in date, the check-in status data (i.e., normal check-in data) is recorded in the corresponding bit of the first data area; that is, the bit data in the first data area corresponding to the check-in date is set to 1 to indicate that the check-in status has been achieved. If the check-in date is a previous date and the check-in type is make-up check-in, then in step 230, according to the check-in date, the check-in status data (i.e., make-up check-in data) is recorded in the corresponding bit of the second data area; that is, the bit data in the second data area corresponding to the check-in date is set to 1 to indicate that the check-in status has been achieved.
[0051] Finally, in step 240, a check-in status field can be generated and stored based on the check-in status data of all bit records in the first and second data areas of the check-in data structure. In this way, multi-day check-in status data from multiple bit records can be compressed and stored into a single field.
[0052] In one embodiment, bitwise operations can be performed on the check-in status data (0 or 1) of all bit records in the first and second data areas of the check-in data structure to obtain a check-in status field. Here, the check-in status field is, for example, decimal data.
[0053] According to one embodiment of the present invention, the check-in data structure can be used to record the check-in status data of the same user for each day within a month. That is, the first data area and the second data area can each record the check-in status data of the user for each day within a month. Since a month includes a maximum of 31 days, each bit is used to record the check-in data for one day. Based on this, assuming that the first data area and the second data area each include N bits (the check-in data structure contains a total of 2N bits), then N > 31, so that the user's daily check-in status data within a month can be recorded according to the first data area and the second data area of the check-in data structure. Furthermore, the corresponding check-in type can be determined based on the first data area and the second data area where the check-in status data is located.
[0054] In one embodiment, the first data area and the second data area can each include 32 bits. It is understood that a 32-bit data area can completely cover any day within each month. Thus, the check-in data structure provided by this invention contains a total of 64 bits, with a length of 8 bytes, where each data area is 4 bytes in size.
[0055] In one embodiment, the first data area is the low-order data area, and the second data area is the high-order data area. Specifically, Figure 3 A schematic diagram of the check-in data structure according to an embodiment of the present invention is shown.
[0056] like Figure 3 As shown, the check-in data structure consists of a low-order data area and a high-order data area. Each area comprises 32 bits (binary bits). The low-order data area stores normal check-in data. Specifically, it starts recording the normal check-in status data for the first day of the month from the rightmost bit, the second bit from the rightmost bit records the normal check-in status data for the second day of the month, and so on, up to the 31st bit from the rightmost bit recording the normal check-in status data for the 31st day of the month. The 32nd bit from the rightmost bit is reserved and fixed at 0.
[0057] The high-order data area is used to store supplementary check-in data. Specifically, it starts recording the supplementary check-in status data for the 1st day of the month from the 33rd position on the right of the entire check-in data structure, the supplementary check-in status data for the 2nd day of the month from the 34th position on the right, and so on, up to the 63rd position on the right to record the supplementary check-in status data for the 31st day of the month. The 64th position on the right is reserved and fixed at 0.
[0058] In one embodiment, a monthly check-in status field corresponding to the month can be generated and stored based on the daily check-in status data (including normal check-in status data and supplementary check-in status data) recorded in the first and second data areas (a total of 2N bits) of the check-in data structure. This allows the user's monthly check-in status data to be stored based on a single field. Specifically, the monthly check-in status field can be obtained by performing bitwise operations on the check-in status data (0 or 1) recorded in all bits of the first and second data areas of the check-in data structure.
[0059] For example, according to the check-in data structure provided by the present invention, which includes a low-order data area (first data area) and a high-order data area (second data area), daily check-in status data is recorded based on binary bits. Bitwise operations can be performed on the 64-bit binary data (including 32 bits in the low-order data area and 32 bits in the high-order data area) contained in the check-in data structure to calculate the corresponding decimal data, which is used as the monthly check-in status field and stored.
[0060] In one embodiment, a user identifier can be obtained and associated with a monthly check-in status field for storage, so that monthly check-in data can be queried based on the user identifier.
[0061] In one embodiment, after generating the monthly check-in status field corresponding to each month, user check-in data corresponding to the user identifier can be generated and stored based on the user identifier and the monthly check-in status field corresponding to each month within the year to which the check-in belongs. In other words, the user check-in data can include the user identifier, the year to which the check-in belongs, and the monthly check-in status field for each month within the year to which the check-in belongs.
[0062] As can be seen, according to the technical solution of the present invention, the monthly check-in status data of a user can be compressed into a single field for storage. For the same user, the check-in status field is fixed for 12 months within a year, which can effectively reduce the order of magnitude of check-in data storage and improve the performance of check-in data storage and query.
[0063] Figure 4 A schematic diagram of user check-in data storage according to an embodiment of the present invention is shown. Figure 4 As shown, the user check-in data corresponding to user ID U001 includes the monthly check-in status field 2199023273471 for February of 2022 (the year of check-in). The monthly check-in status fields for other months are not shown. The user check-in data corresponding to user ID U002 includes the monthly check-in status field 35184372105240 for February of 2022 (the year of check-in). The monthly check-in status fields for other months are not shown.
[0064] Based on the user check-in data stored in the above embodiments, the user's check-in data on a specified date can be queried according to the specified date.
[0065] Specifically, when a user requests to obtain check-in status information for a specified date, in response to the user's request, the system first queries the user check-in data to retrieve the monthly check-in status field for the corresponding month (specifically, the month within the year containing the specified date). In one embodiment, the user's request to obtain check-in status information for a specified date may include a user identifier, thereby allowing the system to query the user's monthly check-in status field for the corresponding month from the user check-in data based on the user identifier and the specified date.
[0066] Next, based on the obtained monthly check-in status field, the monthly check-in status field can be decoded to generate the check-in status data for each day of the corresponding month.
[0067] Based on the daily check-in status data within the corresponding month, the corresponding position of the specified date in each data area (first data area, second data area) can be determined. This allows us to determine the check-in status (whether the check-in was successful) and check-in type (normal check-in / make-up check-in) for the specified date. Finally, the check-in status information and check-in type information are returned to the client user.
[0068] In addition, based on the user check-in data stored in the above embodiments, the number of consecutive check-in days of a user in the corresponding month can also be queried according to a specified date.
[0069] Specifically, when a user requests the number of consecutive check-in days in the month containing a specified date, in response to this request, the system first queries the user's check-in data to retrieve the monthly check-in status field for the corresponding month (specifically, the month within the year containing the specified date). Furthermore, the user's request for the number of consecutive check-in days in the month containing a specified date can also include a user identifier; therefore, the monthly check-in status field for the corresponding month can be retrieved based on the user identifier and the specified date.
[0070] Next, based on the obtained monthly check-in status field, it can be decoded to generate the check-in status data for each day of the corresponding month.
[0071] Based on the daily check-in status data within the corresponding month (see the check-in data structure above), the number of consecutive check-in days in that month can be determined and returned to the client user.
[0072] It is understandable that, in this embodiment, the system can also determine whether all days of the month are in a checked-in state based on the daily check-in status data within the corresponding month.
[0073] It should be noted that, according to the above embodiments of the present invention, the check-in status field for the same user is fixed for 12 months within a year, thereby greatly reducing the complexity of calculating the number of consecutive check-in days.
[0074] In one embodiment, when a user requests to clear the check-in status data for a specified date, in response to the user's request, the monthly check-in status field for the corresponding month can be retrieved from the user's check-in data based on the specified date. Subsequently, based on the retrieved monthly check-in status field, it can be decoded to generate daily check-in status data for the corresponding month. Then, based on the daily check-in status data for the corresponding month, the corresponding positions for the specified date in the first data area and the second data area are determined, and the check-in status data recorded in the corresponding positions in both the first and second data areas is cleared.
[0075] As can be seen, the sign-in data compression and storage method 200 of the present invention redefines the sign-in data structure, dividing the data into a low-bit data area and a high-bit data area, which are used to record normal sign-in status data and supplementary sign-in status data, respectively. Each data area occupies multiple bits (e.g., 32 bits), and daily sign-in status data is recorded bit by bit. In this way, daily sign-in status data of a user within a month can be recorded based on the sign-in data structure. Specifically, when a user sign-in request is received, the sign-in type is first determined as normal sign-in or supplementary sign-in, and the already signed-in status data is recorded in the corresponding bit of the corresponding data area according to the sign-in date. Furthermore, the sign-in status data recorded in all bits of the sign-in data structure is calculated to obtain a sign-in status field for storage. In this way, the present invention can compress the user's monthly sign-in status data into a single field for storage, thereby effectively reducing the order of magnitude of sign-in data storage and improving the performance of sign-in data storage and query. Furthermore, according to the check-in data compression and storage scheme of the present invention, check-in status data can be stored and updated bit by bit. Users concurrently saving and updating check-in status data will not affect the correctness of the final data, thereby reducing the data processing complexity in concurrent scenarios. In addition, the present invention utilizes bitwise operations to store a fixed 12 check-in fields for the same user within a year, thereby reducing the complexity of calculating consecutive check-in days.
[0076] A9. The method described in A8, wherein the request to obtain the check-in status information for a specified date includes a user identifier; obtaining the monthly check-in status field for the corresponding month based on the specified date includes: obtaining the user's monthly check-in status field for the corresponding month based on the user identifier and the specified date.
[0077] A10. The method as described in any one of A6-A9, further comprising: in response to a request to obtain the number of consecutive check-in days in the month containing a specified date, obtaining a monthly check-in status field for the corresponding month based on the specified date; generating daily check-in status data for the corresponding month based on the monthly check-in status field; determining the number of consecutive check-in days for the month based on the daily check-in status data for the corresponding month and returning it.
[0078] A11, the method as described in any one of A1-A10, wherein the first data area and the second data area each comprise 32 bits.
[0079] A12. The method as described in any one of A1-A11, wherein the first data area is a low-order data area and the second data area is a high-order data area.
[0080] The various techniques described herein can be implemented in combination with hardware or software, or a combination thereof. Thus, the methods and apparatus of the present invention, or certain aspects or portions thereof, can take the form of program code (i.e., instructions) embedded in a tangible medium, such as a removable hard disk, USB flash drive, floppy disk, CD-ROM, or any other machine-readable storage medium, wherein when the program is loaded into and executed by a machine such as a computer, the machine becomes an apparatus for practicing the present invention.
[0081] When the program code is executed on a programmable computer, the mobile terminal generally includes a processor, a processor-readable storage medium (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device. The memory is configured to store program code; the processor is configured to execute the check-in data compression storage method of the present invention according to instructions in the program code stored in the memory.
[0082] By way of example, and not limitation, readable media include readable storage media and communication media. Readable storage media stores information such as computer-readable instructions, data structures, program modules, or other data. Communication media generally embodies computer-readable instructions, data structures, program modules, or other data in the form of modulated data signals such as carrier waves or other transmission mechanisms, and includes any information delivery medium. Any combination of the above is also included within the scope of readable media.
[0083] In the specification provided herein, the algorithms and displays are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used with the examples of this invention. The required structure for constructing such systems is apparent from the above description. Furthermore, this invention is not directed to any particular programming language. It should be understood that the contents of the invention described herein can be implemented using various programming languages, and the above description of specific languages is for the purpose of disclosing the best mode of implementation of the invention.
[0084] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.
[0085] Similarly, it should be understood that, in order to streamline this disclosure and aid in understanding one or more of the various aspects of the invention, in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof.
[0086] Those skilled in the art will understand that modules, units, or components of the devices disclosed in the examples herein can be arranged in the devices described in this embodiment, or alternatively, can be located in one or more devices different from the devices in this example. The modules in the foregoing examples can be combined into a single module or, in addition, can be divided into multiple sub-modules.
[0087] Those skilled in the art will understand that the modules in the device of the embodiment can be adaptively changed and placed in one or more devices different from that embodiment. Modules, units, or components in the embodiment can be combined into a single module, unit, or component, and further, they can be divided into multiple sub-modules, sub-units, or sub-components.
[0088] Furthermore, those skilled in the art will understand that although some embodiments described herein include certain features included in other embodiments but not others, combinations of features from different embodiments are meant to be within the scope of the invention and form different embodiments.
[0089] Furthermore, some of the embodiments described herein are methods or combinations of method elements that can be implemented by a processor of a computer system or by other means of performing the functions. Therefore, a processor having the necessary instructions for implementing the methods or method elements forms means for implementing the methods or method elements. Furthermore, the elements described herein in the apparatus embodiments are examples of means for implementing the functions performed by the objective elements for carrying out the invention.
[0090] As used herein, unless otherwise specified, the use of ordinal numbers such as “first,” “second,” “third,” etc., to describe ordinary objects merely indicates different instances of similar objects and is not intended to imply that the objects being described must have a given order in time, space, ordering, or any other manner.
[0091] Although the invention has been described with respect to a limited number of embodiments, those skilled in the art will understand from the foregoing description that other embodiments are conceivable within the scope of the invention described herein. Furthermore, it should be noted that the language used in this specification has been chosen primarily for readability and edibility purposes, and not for the purpose of explaining or limiting the subject matter of the invention.
Claims
1. A method for compressing and storing check-in data, executed in a computing device, storing check-in status data based on a check-in data structure, wherein the check-in data structure includes a first data area and a second data area, the first data area being a low-order data area and the second data area being a high-order data area, the first data area and the second data area each including N bits, each bit being suitable for recording one day's check-in status data, wherein... N > 31, so as to record the daily check-in status data within a month. The check-in status data includes checked-in status data and unchecked-in status data, wherein each bit is adapted to use 1 and 0 respectively to represent checked-in status and unchecked-in status, as checked-in status data and unchecked-in status data; the method includes: In response to a check-in request for a given check-in date, the check-in type corresponding to the check-in request is determined, and the check-in type includes normal check-in and make-up check-in; Determine the target data area corresponding to the check-in type, wherein the normal check-in corresponds to the first data area, and the supplementary check-in corresponds to the second data area; Recording the signed-in status data into the corresponding position of the target data area according to the pending sign-in date includes: if the sign-in type is normal sign-in, then the signed-in status data is recorded into the corresponding position of the first data area according to the pending sign-in date; if the sign-in type is supplementary sign-in, then the signed-in status data is recorded into the corresponding position of the second data area according to the pending sign-in date. Bitwise operations are performed on the daily check-in status data of all bit records in the first and second data areas of the check-in data structure within a month to obtain the monthly check-in status field corresponding to the month and store it. Based on the user identifier and the monthly check-in status field corresponding to each month of the year to which the check-in belongs, generate and store user check-in data corresponding to the user identifier; In response to a request to obtain check-in status information for a specified date, the request includes a user identifier; based on the user identifier and the specified date, the user's monthly check-in status field for the corresponding month is obtained; based on the monthly check-in status field, daily check-in status data for the corresponding month is generated; based on the daily check-in status data for the corresponding month, the check-in status and check-in type for the specified date are determined and returned.
2. The method as described in claim 1, wherein, Based on the pending check-in date, the checked-in status data is recorded in the corresponding position of the target data area, including: Set the bit data in the target data area corresponding to the check-in date to 1 to indicate that the check-in status has been achieved.
3. The method as described in claim 1, wherein, Also includes: In response to a request to obtain the number of consecutive check-in days in the month containing a specified date, the monthly check-in status field for the corresponding month is obtained based on the specified date; Based on the monthly check-in status field, generate daily check-in status data for the corresponding month; Based on the daily check-in status data within the corresponding month, determine the number of consecutive check-in days for that month and return the result.
4. The method according to any one of claims 1-3, wherein, The first data area and the second data area each contain 32 bits.
5. A computing device, comprising: At least one processor; as well as A memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, the program instructions including instructions for performing the method as described in any one of claims 1-4.
6. A readable storage medium storing program instructions that, when read and executed by a computing device, cause the computing device to perform the method as described in any one of claims 1-4.
Citation Information
Patent Citations
Supplementary sign-in data processing method and system
CN108170829A
Data storage method based on binary and dictionary table for multi-valued data
CN109388635A
Data storage method and device
CN113239303A
Sign-in data management system, method and device, medium and product
CN115345574A