Paging caching method and related device

By configuring the shared cache paging size for multiple interface types under the same data list, and calculating the cache page number and data subscript range according to the query request, thereby intercepting the paging data list, the problem of excessive cache occupancy of paging data lists of different interface types is solved, and storage space is saved.

CN119988769AActive Publication Date: 2025-05-13GUANGZHOU QIANJUN NETWORK TECH CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202510473284.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-16
Publication Date
2025-05-13
Estimated Expiration
2045-04-16

AI Technical Summary

Technical Problem

In the prior art, when the same data list displays different paging sizes in different web pages, the web service needs to cache paging data lists of different interface types, which greatly occupies storage space.

Method used

By configuring multiple interface types under the same data list to share a cache paging size, after receiving the query request, the cache page number is calculated based on the query paging size, query page number and cache paging size, the cache data list is obtained and the data subscript range is determined, thereby intercepting the paging data list of the target interface type.

Benefits of technology

It realizes the reduction of the storage space occupied by cached various paging data lists, and saves storage space to the greatest extent by sharing the cache paging size and reasonably calculating the cache page number.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119988769A_ABST
    Figure CN119988769A_ABST
Patent Text Reader

Abstract

The invention provides a paging caching method and a related device, relates to the technical field of software, and configures the same cache paging size for a plurality of interface types under a target data list. Receiving a query request for the target data list, wherein the query request comprises a query paging size and a query page number corresponding to the target interface type; calculating a cache page number according to the query page size, the query page number and the cache page size; obtaining a cache data list corresponding to the cache page number, and determining a first data subscript range corresponding to the cache data list; and calculating a second data subscript range by utilizing the query paging size and the query page number, intercepting a paging data list of the target interface type from the cache data list according to an intersection of the first data subscript range and the second data subscript range, and outputting the paging data list. According to the method and the device, various interfaces can share one cache, the interface request is converted into cache internal operation, and the storage space is saved to the greatest extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software technology, and in particular to a paging cache method and related devices. Background Art

[0002] At present, the same data list needs to be displayed in different page sizes on different web pages. The browser will request the required paged data list from the web service interface according to the display requirements of the current web page.

[0003] In order to bear the pressure of interface requests, web services will set up caches for paginated data lists of various interfaces. This means that one data list will cache paginated data lists of different interface types, which greatly occupies the storage space of web services. Summary of the invention

[0004] In view of the above problems, the present application provides a paging cache method and related devices to achieve the purpose of reducing the storage space occupied by caching various paging data lists. The specific scheme is as follows:

[0005] A first aspect of the present application provides a paging cache method, the paging cache method comprising:

[0006] Receive a query request for a target data list, wherein the query request includes a query paging size and a query page number corresponding to the target interface type;

[0007] Calculating a cache page number according to the query page size, the query page number, and a configured cache page size, wherein the cache page size is configured for a plurality of interface types under the target data list;

[0008] Obtaining a cache data list corresponding to the cache page number, and determining a first data subscript range corresponding to the cache data list;

[0009] The second data subscript range is calculated using the query paging size and the query page number, and a paging data list of the target interface type is obtained from the cache data list according to the intersection of the first data subscript range and the second data subscript range, and the paging data list is output.

[0010] In a possible implementation, the configuration method of the cache paging size includes:

[0011] Acquire multiple initial paging sizes corresponding to the multiple interface types, where one interface type corresponds to one initial paging size;

[0012] Taking the least common multiple of the multiple initial paging sizes as a candidate paging size;

[0013] Determining whether the candidate paging size is smaller than a preset paging size threshold;

[0014] If so, using the candidate paging size as the cache paging size;

[0015] If not, the cache page size is selected from the multiple initial page sizes.

[0016] In a possible implementation, calculating the cache page number according to the query paging size, the query page number, and the configured cache paging size includes:

[0017] Comparing the query paging size with the cache paging size;

[0018] In the case where the query page size is smaller than the cache page size, determining whether the cache page size is divisible by the query page size; if so, processing the cache page size, the query page size and the query page number in a rounding-up manner to obtain the cache page number; if not, calculating a first data subscript boundary according to the query page number and the query page size, and processing the first data subscript boundary and the cache page size in a rounding-up manner to obtain the cache page number;

[0019] When the query page size is equal to the cache page size, using the query page number as the cache page number;

[0020] In the case where the query page size is larger than the cache page size, determine whether the query page size is divisible by the cache page size; if so, calculate a second data subscript boundary based on the query page number and the query page size, and use the second data subscript boundary and the cache page size to calculate the cache page number; if not, calculate a third data subscript boundary based on the query page number and the query page size, and process the third data subscript boundary and the cache page size in a rounded manner to obtain the cache page number.

[0021] In a possible implementation, obtaining the cache data list corresponding to the cache page number includes:

[0022] In the case where there are multiple cache page numbers, a concurrent thread is used to obtain the cache data list corresponding to each cache page number.

[0023] In a possible implementation, obtaining the cache data list corresponding to the cache page number includes:

[0024] Using the cache page number to query whether the cache data list exists in the cache resource;

[0025] If so, obtain the cache data list;

[0026] If not, a fourth data subscript boundary is calculated according to the cache page number and the cache paging size, and an original data list in the database is obtained by querying according to the fourth data subscript boundary, and the original data list is cached to obtain the cache data list.

[0027] In a possible implementation, determining the first data subscript range corresponding to the cached data list includes:

[0028] Determine a data subscript starting boundary in the fourth data subscript boundary;

[0029] Merging the cache data lists according to the cache page numbers, and counting the total number of data items in the merged cache data lists;

[0030] The data subscript start boundary and the total number of data are used to determine the real data subscript end boundary, and the data subscript start boundary and the real data subscript end boundary constitute the first data subscript range.

[0031] A second aspect of the present application provides a paging cache device, the paging cache device comprising:

[0032] A request receiving module, used to receive a query request for a target data list, wherein the query request includes a query paging size and a query page number corresponding to the target interface type;

[0033] a cache processing module, configured to calculate a cache page number according to the query page size, the query page number and a configured cache page size, wherein the cache page size is configured for a plurality of interface types under the target data list; obtain a cache data list corresponding to the cache page number, and determine a first data subscript range corresponding to the cache data list;

[0034] The cache output module is used to calculate a second data index range using the query paging size and the query page number, obtain a paging data list of the target interface type from the cache data list according to the intersection of the first data index range and the second data index range, and output the paging data list.

[0035] A third aspect of the present application provides a computer program product, including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements the paging cache method of the first aspect or any implementation of the first aspect.

[0036] A fourth aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:

[0037] The memory is used to store computer programs;

[0038] The processor is used to execute the computer program so that the electronic device can implement the paging cache method of the first aspect or any implementation manner of the first aspect.

[0039] In a fifth aspect, the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement the paging cache method of the first aspect or any implementation method of the first aspect.

[0040] By means of the above technical solution, the present application provides a paging cache method and related devices, which configure the same cache paging size for multiple interface types under the target data list. Receive a query request for the target data list, the query request includes the query paging size and query page number corresponding to the target interface type; calculate the cache page number according to the query paging size, query page number and cache paging size; obtain the cache data list corresponding to the cache page number, and determine the first data subscript range corresponding to the cache data list; calculate the second data subscript range using the query paging size and query page number, obtain the paging data list of the target interface type from the cache data list according to the intersection of the first data subscript range and the second data subscript range, and output the paging data list. The present application can configure a cache paging size for the same data list. When facing a query request of the target interface type, the cache page number can be calculated based on the query paging size, query page number and cache paging size, so as to obtain the cache data list and determine the corresponding data subscript range. The query paging size and query page number are used to calculate the data subscript range to be queried, and the paging data list is intercepted from the cache data list with the intersection of the data subscript range for output. This allows various interfaces to share a cache, convert interface requests into cache internal operations, and save storage space to the greatest extent. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.

[0042] Figure 1 A schematic diagram of a flow chart of a paging cache method provided in an embodiment of the present application;

[0043] Figure 2 A partial flow chart of a paging cache method provided in an embodiment of the present application;

[0044] Figure 3 A schematic diagram of another part of the flow chart of a paging cache method provided in an embodiment of the present application;

[0045] Figure 4 A schematic diagram of another part of the flow chart of a paging cache method provided in an embodiment of the present application;

[0046] Figure 5 A schematic diagram of the structure of a paging cache device provided in an embodiment of the present application;

[0047] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0048] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.

[0049] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0050] The terms "first", "second" etc. in the specification of the application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable in appropriate circumstances, and this is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.

[0051] For ease of understanding, the application is explained by taking the data list as a video list as an example. It can be understood that the data list includes but is not limited to the video list, and can also be other types of lists, such as a fan list, etc., which is not limited in the embodiment of the application. The video list records the description information of multiple video objects, and the description information includes but is not limited to the video subscript (i.e., the serial number of the video object), video ID, video title, video upload user, video cover image address, video playback file address, etc.

[0052] Generally speaking, the same video list needs to display different paging size effects on different web pages. For example, the user's homepage needs to display a paging data list with 4 video objects per page, while the user's video details page needs to display a paging data list with 40 video objects per page. The paging data list is the result of splitting the row records in the video list according to the paging size.

[0053] The browser will request the required paginated data list from the web service interface according to the display requirements of the current web page, and the request will carry the pagination size and page number. In order to bear the pressure of interface requests and avoid database crashes caused by high concurrent queries, the web service will use the pagination size and page number in the request as the key to cache the paginated data list. Assuming that the video list records the description information of 100 video objects and the storage space is 1M, two types of cache data need to be set for the user home page and user video details page:

[0054] User home page: key = user ID + paging size (equal to 4) + page number, value = paging data list of the page number, a total of 25 paging data lists;

[0055] User video details page: key = user ID + paging size (equal to 40) + page number, value = paging data list of the page number, a total of 3 paging data lists.

[0056] Since there are cached data for two types of interfaces, the user home page and the user video details page, this requires 2M of storage space for the web service, that is, N types of interfaces require N times the storage space to cache the paging data list. However, the cache generally occupies the server memory, which is not only expensive in physical resources, but also affects the performance of the web service.

[0057] To solve the above problems, an embodiment of the present application provides a paging cache method. The paging cache method of the embodiment of the present application is described in detail below in conjunction with the accompanying drawings.

[0058] See also Figure 1 , Figure 1 A schematic diagram of a paging cache method provided in an embodiment of the present application. Figure 1 As shown, a paging cache method provided by an embodiment of the present application is applied to web services and may include steps S101 to S104, which are described in detail below.

[0059] S101, receiving a query request for a target data list, wherein the query request includes a query paging size and a query page number corresponding to a target interface type.

[0060] In the embodiment of the present application, the target data list is a data list to be queried by the browser, which may be a video list, a fan list, etc. The target interface type is an interface type under the target data list queried by the browser, such as the user homepage under the video list, or the user video details interface type.

[0061] According to the display requirements of the current web page, the browser requests the web service for the paging data list of the target interface type, and the query request sent includes the paging size to be queried (i.e., the query paging size) and the page number (i.e., the query page number). In response, the web service receives the query request from the browser and parses it to obtain the query paging size and query page number.

[0062] S102, calculating a cache page number according to the query page size, the query page number and the configured cache page size, where the cache page size is configured for multiple interface types under the target data list.

[0063] In the embodiment of the present application, the same cache paging size is configured for different interface types under the same data list, and multiple interface types under the target data list have the same cache paging size. The data index range to be queried is determined based on the query paging size and the query page number. Taking the video list as an example, the data index range is the video index range. Furthermore, the page number (i.e., the cache page number) where the data index range is located is determined in combination with the cache paging size.

[0064] In a possible implementation, the cache page size can be configured according to the page size required to be displayed by different interface types. Figure 2 , Figure 2 A partial flow chart of a paging cache method provided in an embodiment of the present application. Figure 2 As shown, an embodiment of the present application provides a paging cache method, wherein the configuration method of the cache paging size may include steps S201 to S205, and these steps are described in detail below.

[0065] S201, obtaining multiple initial paging sizes corresponding to multiple interface types, where one interface type corresponds to one initial paging size.

[0066] In the embodiment of the present application, for each interface type under the target data list, the page size required by the interface type (ie, the initial page size) is obtained. Thus, the initial page sizes of multiple interface types can be obtained, ie, multiple initial page sizes.

[0067] S202: Taking the lowest common multiple of a plurality of initial page sizes as a candidate page size.

[0068] In the embodiment of the present application, the least common multiple of multiple initial paging sizes is calculated, and the least common multiple is used as the candidate paging size. For ease of understanding, assuming that there are 3 interface types under the video list, the initial paging sizes are 4 (i.e., 4 video objects are one page), 10 (i.e., 10 video objects are one page), and 20 (i.e., 20 video objects are one page), respectively. The least common multiple 20 can be determined as the candidate paging size.

[0069] S203, determining whether the candidate page size is smaller than a preset page size threshold; if so, executing step S204; if not, executing step S205.

[0070] In the embodiment of the present application, the paging size threshold is determined according to the size of a single data block of the cache service and is compared with the candidate paging sizes.

[0071] S204: Use the candidate paging size as the cache paging size.

[0072] In the embodiment of the present application, if the candidate page size is less than the page size threshold, the candidate page size can be used as the cache page size. Continuing with the above video list as an example, assuming that the page size threshold is 25, the cache page size can be determined to be 20.

[0073] S205: Select a cache paging size from a plurality of initial paging sizes.

[0074] In an embodiment of the present application, if the candidate paging size is greater than or equal to the paging size threshold, one of the multiple initial paging sizes can be selected as the cache paging size in a compromise manner to ensure that the cache paging size can be divided by the most initial paging sizes, thereby minimizing the data transmission time between the cache service.

[0075] In a possible implementation, the cache page number can be calculated according to the size relationship between the query page size and the cache page size. In this regard, the embodiment of the present application provides a paging cache method, wherein the "calculating the cache page number according to the query page size, the query page number and the configured cache page size" in step S102 can include the following steps, which are described in detail below.

[0076] Compare query page size and cache page size;

[0077] In the case where the query page size is smaller than the cache page size, determining whether the cache page size is divisible by the query page size; if so, processing the cache page size, the query page size, and the query page number in a round-up manner to obtain the cache page number; if not, calculating the first data subscript boundary according to the query page number and the query page size, and processing the first data subscript boundary and the cache page size in a round-up manner to obtain the cache page number;

[0078] When the query page size is equal to the cache page size, the query page number is used as the cache page number;

[0079] When the query page size is larger than the cache page size, determine whether the query page size is divisible by the cache page size; if so, calculate the second data subscript boundary according to the query page number and the query page size, and use the second data subscript boundary and the cache page size to calculate the cache page number; if not, calculate the third data subscript boundary according to the query page number and the query page size, and process the third data subscript boundary and the cache page size in a rounded manner to obtain the cache page number.

[0080] In the embodiment of the present application, for ease of understanding, the query paging size is defined as pageSize, the cache paging size is defined as cacheSize, the query page number is defined as pageNo, and the cache page number is defined as cacheNo.

[0081] Compare pageSize and cacheSize.

[0082] 1) pageSize is smaller than cacheSize. Determine whether cacheSize is divisible by pageSize. Specifically, determine whether cacheSize% pageSize is equal to 0.

[0083] If cacheSize%pageSize is equal to 0, that is, cacheSize is divisible by pageSize, then cacheNo=round up (pageNo / (cacheSize / pageSize))

[0084] If cacheSize% pageSize is not equal to 0, that is, cacheSize is not divisible by pageSize, there will be a situation where the cache spans multiple pages. In this case, the corresponding data subscript boundary (that is, the first data subscript boundary) is calculated, and the data subscript start boundary in the first data subscript boundary is defined as cacheNoMin1, and the data subscript end boundary is defined as cacheNoMax1. CacheNoMin1=round up ((pageNo-1)×pageSize / cacheSize)+1, cacheNoMax1=round up ((pageNo×pageSize-1) / cacheSize)+1.

[0085] 2) pageSize equals cacheSize. cacheNo = pageNo.

[0086] 3) pageSize is greater than cacheSize. Determine whether pageSize is divisible by cacheSize. Specifically, determine whether pageSize%cacheSize is equal to 0.

[0087] If pageSize%cacheSize is equal to 0, that is, pageSize is divisible by cacheSize, there will be a situation where the cache spans multiple pages. In this case, the corresponding data subscript boundary (that is, the second data subscript boundary) is calculated, and the data subscript start boundary in the second data subscript boundary is defined as cacheNoMin2, and the data subscript end boundary is defined as cacheNoMax2, cacheNoMin2=(pageNo-1)×pageSize / cacheSize+1, cacheNoMax2=pageNo×pageSize / cacheSize.

[0088] If pageSize%cacheSize is not equal to 0, that is, pageSize is not divisible by cacheSize, there will be a situation where the cache spans multiple pages. In this case, the corresponding data subscript boundary (that is, the third data subscript boundary) is calculated, and the data subscript start boundary in the third data subscript boundary is defined as cacheNoMin3, and the data subscript end boundary is defined as cacheNoMax3. CacheNoMin3=round up ((pageNo-1)×pageSize / cacheSize)+1, cacheNoMax3=round up ((pageNo×pageSize-1) / cacheSize)+1.

[0089] S103, obtaining a cache data list corresponding to the cache page number, and determining a first data index range corresponding to the cache data list.

[0090] In an embodiment of the present application, the cache page number can be used as a key to obtain the corresponding cache data list from the cache resource, and then determine the data subscript range of the cache data list (i.e., the first data subscript range), which represents the data subscript range of the data object in the cache data list.

[0091] In a possible implementation, since the cache page number may be one or multiple consecutive cache pages, the cache data lists of multiple cache page numbers can be obtained simultaneously by concurrent threads. In this regard, a paging cache method is provided in an embodiment of the present application, wherein in step S103, "obtaining the cache data list corresponding to the cache page number" can be performed using the following steps:

[0092] When there are multiple cache page numbers, use concurrent threads to obtain the cache data list corresponding to each cache page number.

[0093] In an embodiment of the present application, if there are multiple cache page numbers, a thread can be assigned to each cache page number, and multiple threads can be executed concurrently, while obtaining a cache data list corresponding to each cache page number.

[0094] In a possible implementation, for a query request that does not hit the cache, the corresponding original data list can be obtained from the database and cached as a cache data list, so that the next time the same query request can hit the cache. Figure 3 , Figure 3 Another partial flow chart of a paging cache method provided in an embodiment of the present application. Figure 3 As shown, an embodiment of the present application provides a paging cache method, wherein "obtaining a cache data list corresponding to a cache page number" in step S103 may include steps S301 to S303, and these steps are described in detail below.

[0095] S301, query whether there is a cache data list in the cache resource by using the cache page number; if so, execute step S302; if not, execute step S303.

[0096] In the embodiment of the present application, the cache page number is used as a key to query the cache resource to determine whether there is a corresponding cache data list therein.

[0097] S302, obtaining a cache data list.

[0098] In the embodiment of the present application, if there is a cache data list corresponding to the cache page number in the cache resource, the cache data list is obtained.

[0099] S303, calculating a fourth data subscript boundary according to the cache page number and the cache paging size, querying and obtaining an original data list in the database according to the fourth data subscript boundary, and caching the original data list to obtain a cache data list.

[0100] In an embodiment of the present application, if there is no corresponding cache data list in the cache resource, the corresponding data subscript boundary (i.e., the fourth data subscript boundary) is calculated, and the data subscript starting boundary in the fourth data subscript boundary is defined as queryNoMin, and the data subscript ending boundary is defined as queryNoMax, queryNoMin=(cacheNo-1)×cacheSize, queryNoMax=queryNoMin+cacheSize.

[0101] Query the database with queryNoMin and queryNoMax to obtain the row records of data objects in the database whose data subscripts are between [queryNoMin, queryNoMax), thereby forming a corresponding original data list, and caching the original data list to obtain a cached data list. This ensures that the cache can be hit when the same resource is requested next time.

[0102] On this basis, since cached resources may be lost, it is necessary to count the actual data index range of the cached data list. Figure 4 , Figure 4 Another partial flow chart of a paging cache method provided in an embodiment of the present application. Figure 4 As shown, an embodiment of the present application provides a paging cache method, wherein "determining a first data index range corresponding to a cached data list" in step S103 may include steps S401 to S403, and these steps are described in detail below.

[0103] S401, determine a data subscript start boundary in a fourth data subscript boundary.

[0104] In the embodiment of the present application, a data subscript starting boundary in the fourth data subscript boundary is determined.

[0105] S402: Merge the cache data lists according to the cache page numbers, and count the total number of data items in the merged cache data lists.

[0106] In the embodiment of the present application, when there are multiple cache page numbers, multiple cache data lists can be merged into one list in the order of the multiple cache page numbers, and the total number of data items in the list can be counted. The total number of data items is defined as dataSize, and if dataSize is equal to 0, an empty list is directly returned.

[0107] S403, using the data subscript start boundary and the total number of data items to determine the real data subscript end boundary, the data subscript start boundary and the real data subscript end boundary constitute a first data subscript range.

[0108] In the embodiment of the present application, if dataSize is greater than 0, the real data subscript end boundary of the cached data list (i.e., the real data subscript end boundary) can be determined, and the real data subscript end boundary is defined as dataNoMax, then dataNoMax=queryNoMin+dataSize. At this time, the first data subscript range can be determined to be [queryNoMin, dataNoMax).

[0109] S104, using the query paging size and the query page number to calculate the second data subscript range, intercepting the paging data list of the target interface type from the cache data list according to the intersection of the first data subscript range and the second data subscript range, and outputting the paging data list.

[0110] In the embodiment of the present application, the query paging size and the query page number can be used to calculate the data subscript range of the query request (i.e., the second data subscript range), and the second data subscript range represents the data subscript range of the requested data object. Define the request start subscript as requestNoMin and the request end subscript as requestNoMax, then requestNoMin=(pageNo-1)× pageSize, requestNoMax=requestNoMin+ pageSize, so that the second data subscript range [requestNoMin, requestNoMax) can be obtained.

[0111] The intersection of [queryNoMin, dataNoMax) and [requestNoMin, requestNoMax) is taken, and the corresponding row records are intercepted from the cache data list according to the intersection, so as to form a paginated data list of the target interface type, and the paginated data list is returned to the browser.

[0112] It should be noted that if the intersection of the first data subscript range and the second data subscript range is empty, an empty list is output.

[0113] Through the above description, a paging cache method provided by an embodiment of the present application can configure a cache paging size for the same data list. When facing a query request of the target interface type, the cache page number can be calculated based on the query paging size, the query page number and the cache paging size, so as to obtain the cache data list and determine the corresponding data subscript range, and calculate the data subscript range to be queried by the query paging size and the query page number, and output the paging data list from the cache data list with the intersection of the data subscript range. This can realize that various interfaces share a cache, convert interface requests into cache internal operations, and save storage space to the greatest extent.

[0114] A paging cache method provided by an embodiment of the present application is introduced above, and a device for executing the paging cache method is introduced below.

[0115] See also Figure 5 , Figure 5 A schematic diagram of the structure of a paging cache device provided in an embodiment of the present application. Figure 5 As shown, a paging cache device provided in an embodiment of the present application includes:

[0116] The request receiving module 501 is used to receive a query request for a target data list, wherein the query request includes a query paging size and a query page number corresponding to the target interface type;

[0117] The cache processing module 502 is used to calculate the cache page number according to the query page size, the query page number and the configured cache page size, where the cache page size is configured for multiple interface types under the target data list; obtain the cache data list corresponding to the cache page number, and determine the first data subscript range corresponding to the cache data list;

[0118] The cache output module 503 is used to calculate the second data index range by using the query paging size and the query page number, obtain the paging data list of the target interface type from the cache data list according to the intersection of the first data index range and the second data index range, and output the paging data list.

[0119] In a possible implementation, the cache processing module 502 configures the cache paging size in the following manner:

[0120] Obtain multiple initial page sizes corresponding to multiple interface types, one interface type corresponds to one initial page size; use the lowest common multiple of the multiple initial page sizes as a candidate page size; determine whether the candidate page size is less than a preset page size threshold; if so, use the candidate page size as a cache page size; if not, select a cache page size from the multiple initial page sizes.

[0121] In a possible implementation, the cache processing module 502 for calculating the cache page number according to the query page size, the query page number and the configured cache page size is specifically used to:

[0122] Compare the query page size and the cache page size; when the query page size is smaller than the cache page size, determine whether the cache page size is divisible by the query page size; if so, process the cache page size, the query page size and the query page number in a round-up manner to obtain the cache page number; if not, calculate the first data subscript boundary according to the query page number and the query page size, and process the first data subscript boundary and the cache page size in a round-up manner to obtain the cache page number; when the query page size is equal to the cache page size, use the query page number as the cache page number; when the query page size is larger than the cache page size, determine whether the query page size is divisible by the cache page size; if so, calculate the second data subscript boundary according to the query page number and the query page size, and calculate the cache page number using the second data subscript boundary and the cache page size; if not, calculate the third data subscript boundary according to the query page number and the query page size, and process the third data subscript boundary and the cache page size in a round-up manner to obtain the cache page number.

[0123] In a possible implementation, the cache processing module 502 for obtaining a cache data list corresponding to a cache page number is specifically configured to:

[0124] When there are multiple cache page numbers, use concurrent threads to obtain the cache data list corresponding to each cache page number.

[0125] In a possible implementation, the cache processing module 502 for obtaining a cache data list corresponding to a cache page number is specifically configured to:

[0126] Use the cache page number to query whether there is a cache data list in the cache resource; if so, obtain the cache data list; if not, calculate the fourth data subscript boundary according to the cache page number and the cache paging size, and query according to the fourth data subscript boundary to obtain the original data list in the database, and cache the original data list to obtain the cache data list.

[0127] In a possible implementation, the cache processing module 502 for determining the first data index range corresponding to the cache data list is specifically configured to:

[0128] Determine the data subscript starting boundary in the fourth data subscript boundary; merge the cache data list according to the cache page number, and count the total number of data items in the merged cache data list; use the data subscript starting boundary and the total number of data items to determine the real data subscript ending boundary, and the data subscript starting boundary and the real data subscript ending boundary constitute the first data subscript range.

[0129] It should be noted that the detailed functions of each module in the embodiment of the present application can be found in the corresponding public part of the above-mentioned paging cache method embodiment, and will not be repeated here.

[0130] The present application also provides an electronic device. Figure 6 , Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Figure 6 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0131] like Figure 6 As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 to a random access memory (RAM) 603. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 603. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0132] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a memory card, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0133] An embodiment of the present application also provides a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any paging cache method provided in the embodiment of the present application.

[0134] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any paging cache method provided in an embodiment of the present application.

[0135] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.

[0136] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0137] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0138] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.

Claims

1. A paging cache method, characterized in that: The paging cache method comprises: Receive a query request for a target data list, wherein the query request includes a query paging size and a query page number corresponding to the target interface type; Calculating a cache page number according to the query page size, the query page number, and a configured cache page size, wherein the cache page size is configured for a plurality of interface types under the target data list; Obtaining a cache data list corresponding to the cache page number, and determining a first data subscript range corresponding to the cache data list; The second data subscript range is calculated using the query paging size and the query page number, and a paging data list of the target interface type is obtained from the cache data list according to the intersection of the first data subscript range and the second data subscript range, and the paging data list is output.

2. The paging cache method according to claim 1, characterized in that: The configuration method of the cache paging size includes: Acquire multiple initial paging sizes corresponding to the multiple interface types, where one interface type corresponds to one initial paging size; Taking the least common multiple of the multiple initial paging sizes as a candidate paging size; Determining whether the candidate paging size is smaller than a preset paging size threshold; If so, using the candidate paging size as the cache paging size; If not, the cache page size is selected from the multiple initial page sizes.

3. The paging cache method according to claim 1, characterized in that: The calculating the cache page number according to the query paging size, the query page number and the configured cache paging size includes: Comparing the query paging size with the cache paging size; In the case where the query page size is smaller than the cache page size, determining whether the cache page size is divisible by the query page size; if so, processing the cache page size, the query page size and the query page number in a rounding-up manner to obtain the cache page number; if not, calculating a first data subscript boundary according to the query page number and the query page size, and processing the first data subscript boundary and the cache page size in a rounding-up manner to obtain the cache page number; When the query page size is equal to the cache page size, using the query page number as the cache page number; In the case where the query page size is larger than the cache page size, determine whether the query page size is divisible by the cache page size; if so, calculate a second data subscript boundary based on the query page number and the query page size, and use the second data subscript boundary and the cache page size to calculate the cache page number; if not, calculate a third data subscript boundary based on the query page number and the query page size, and process the third data subscript boundary and the cache page size in a rounded manner to obtain the cache page number.

4. The paging cache method according to claim 1, characterized in that: The obtaining of the cache data list corresponding to the cache page number includes: In the case where there are multiple cache page numbers, a concurrent thread is used to obtain the cache data list corresponding to each cache page number.

5. The paging cache method according to claim 1, characterized in that: The obtaining of the cache data list corresponding to the cache page number includes: Using the cache page number to query whether the cache data list exists in the cache resource; If so, obtain the cache data list; If not, a fourth data subscript boundary is calculated according to the cache page number and the cache paging size, and an original data list in the database is obtained by querying according to the fourth data subscript boundary, and the original data list is cached to obtain the cache data list.

6. The paging cache method according to claim 5, characterized in that: The determining the first data index range corresponding to the cached data list includes: Determine a data subscript starting boundary in the fourth data subscript boundary; Merging the cache data lists according to the cache page numbers, and counting the total number of data items in the merged cache data lists; The data subscript start boundary and the total number of data are used to determine the real data subscript end boundary, and the data subscript start boundary and the real data subscript end boundary constitute the first data subscript range.

7. A paging cache device, characterized in that: The paging cache device comprises: A request receiving module, used to receive a query request for a target data list, wherein the query request includes a query paging size and a query page number corresponding to the target interface type; a cache processing module, configured to calculate a cache page number according to the query page size, the query page number and a configured cache page size, wherein the cache page size is configured for a plurality of interface types under the target data list; obtain a cache data list corresponding to the cache page number, and determine a first data subscript range corresponding to the cache data list; The cache output module is used to calculate a second data index range using the query paging size and the query page number, obtain a paging data list of the target interface type from the cache data list according to the intersection of the first data index range and the second data index range, and output the paging data list.

8. A computer program product, characterized in that It comprises computer-readable instructions, and when the computer-readable instructions are executed on an electronic device, the electronic device implements the paging cache method as claimed in any one of claims 1 to 6.

9. An electronic device, characterized in that: The method comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the electronic device can implement the paging cache method as described in any one of claims 1 to 6.

10. A computer storage medium, characterized in that: The storage medium carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, the electronic device can implement the paging cache method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • WEB caching method based on paging

    CN106339508A

  • List paging method, device and electronic equipment

    CN108153847A

  • Paging query method and device, equipment and storage medium

    CN112699147A

  • Method, device and equipment for data deep paging query

    CN113590623A

  • Document data query method and query system and storage medium

    CN117171404A