File downloading method, device, equipment, storage medium and product
By setting up a cache database in the object storage cloud service system and using user identification for file download authentication, the security risks and performance issues of user permission control in the object storage service are solved, a low-complexity file download method is implemented, and service performance and security are improved.
Patent Information
- Application Number
- CN202310007687.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-04
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2043-01-04
AI Technical Summary
Existing object storage services cannot effectively control user permissions when downloading files, leading to security risks. In addition, the authentication method is complex and costly, and the service response time is too long, which reduces performance.
A cache database is set up in the object storage cloud service system, and a list of user downloadable files is stored by associating the user ID. The cache database is used for permission query and file download authentication, separating the file download and authentication processes.
It reduces the complexity of application development, saves costs, shortens service response time, and improves the performance and security of object storage services.
Smart Images

Figure CN116016495B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of data processing technology, and in particular relates to a file downloading method, device, equipment, storage medium and product. Background Art
[0002] With the rapid development of the internet, more and more enterprises are migrating their businesses to the cloud, leading to a rapid increase in demand for cloud storage. Object storage services help enterprises manage large amounts of data, providing public services for users to upload and download files. However, object storage services are unable to control user permissions when downloading files, posing a security risk.
[0003] The existing object storage authentication method for storing user information is complex and costly in application development, and causes object storage to be dependent on the application. The callback interface method for querying user download file permissions results in a long service response time, which reduces the performance of the object storage service. Summary of the Invention
[0004] The embodiments of the present application provide a file download method, apparatus, device, storage medium and product, which can reduce the complexity of application development, save costs, reduce application service response time, and improve application service performance.
[0005] In a first aspect, an embodiment of the present application provides a file download method, which is applied to an object storage cloud service system, wherein the object storage cloud service system is provided with a cache database, and the method includes:
[0006] Receiving a cache request for a user downloadable file list sent by an application server, the cache request including a user identifier and the user downloadable file list, wherein the user downloadable file list includes a file identifier of at least one downloadable file corresponding to the user identifier;
[0007] In response to the cache request, the user identification and the list of downloadable files for the user are associated and stored in the cache database;
[0008] receiving a first file download request for a target file sent by an application terminal device, the first file download request including a user identifier and a target file identifier corresponding to the target file;
[0009] In response to the first file download request, obtaining a list of user downloadable files from a cache database according to the user identifier;
[0010] In a case where the target file identifier is included in the user downloadable file list, the target file is acquired and sent to the application terminal device.
[0011] In a second aspect, an embodiment of the present application provides a file download method, applied to an application server, the method comprising:
[0012] receiving a second file download request sent by the application terminal device, the second file download request including a user identifier of a target user and a file identifier corresponding to at least one file, where the target user is a user logged in to the application terminal device;
[0013] In response to the second file download request, querying the target user's download authority for at least one file according to the user identifier to obtain a query result;
[0014] If the query result indicates that the target user has download permission, generating a list of files that the user can download based on the file identifier corresponding to at least one file;
[0015] Send a cache request for the user's downloadable file list to the object storage cloud service system.
[0016] In a third aspect, an embodiment of the present application provides a file downloading device, which is applied to an object storage cloud service system, wherein the object storage cloud service system is provided with a cache database, and the device includes:
[0017] a first receiving module, configured to receive a cache request for a user downloadable file list sent by an application server, the cache request including a user identifier and the user downloadable file list, wherein the user downloadable file list includes a file identifier of at least one downloadable file corresponding to the user identifier;
[0018] A first response module, configured to respond to a cache request and associate the user identifier with the user's downloadable file list and store it in a cache database;
[0019] A second receiving module is configured to receive a first file download request for a target file sent by an application terminal device, where the first file download request includes a user identifier and a target file identifier corresponding to the target file;
[0020] A second response module is configured to respond to the first file download request and obtain a list of user downloadable files from a cache database according to the user identifier;
[0021] The acquisition module is used to acquire the target file when the target file identifier is included in the user downloadable file list, and send the target file to the application terminal device.
[0022] In a fourth aspect, an embodiment of the present application provides a file downloading device, applied to an application server, the device comprising:
[0023] a third receiving module, configured to receive a second file download request sent by the application terminal device, the second file download request including a user identifier of a target user and a file identifier corresponding to at least one file, the target user being a user logged in to the application terminal device;
[0024] a third response module, configured to query the target user's download authority for at least one file according to the user identifier in response to the second file download request, and obtain a query result;
[0025] A generating module, configured to generate a list of user-downloadable files based on a file identifier corresponding to at least one file when the query result indicates that the target user has download permission;
[0026] The first sending module is used to send a cache request for a list of user downloadable files to the object storage cloud service system.
[0027] In a fifth aspect, an embodiment of the present application provides an electronic device, the electronic device comprising: a processor and a memory storing computer program instructions;
[0028] When the processor executes the computer program instructions, the steps of the file downloading method described in any one of the embodiments of the first aspect or the second aspect are implemented.
[0029] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the steps of the file downloading method described in any embodiment of the first aspect or the second aspect are implemented.
[0030] In the seventh aspect, an embodiment of the present application provides a computer program product. When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device performs the steps of the file downloading method described in any embodiment of the first aspect or the second aspect.
[0031] The file downloading method, apparatus, device, storage medium and product in the embodiments of the present application associate and store the user identifier and the user's downloadable file list in a cache database set up in the object storage cloud service system. When the user downloads the target file, the object storage cloud service system queries the user's downloadable file list cached in the cache database based on the user identifier, and sends the acquired target file to the application terminal device if the user's downloadable file list contains the target file identifier. When the user downloads a file, the cache database is used to cache the user's downloadable file list, which is simple to modify, has low application development complexity, and greatly saves costs. In addition, the cache database is used to perform file download authentication based on the user identifier, and the target file is provided to the user after determining that the user has download permission. The file download authentication is separated from the file download, which reduces calls to the application backend, reduces service response time, and improves service performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0033] Figure 1 This is a flowchart of a file download process in the file download method provided in an embodiment of the present application;
[0034] Figure 2 This is a flowchart of a file download method provided by an embodiment of the first aspect of the present application;
[0035] Figure 3 This is a flowchart of another file downloading method provided in an embodiment of the present application;
[0036] Figure 4 This is a flowchart of a file download method provided by an embodiment of the second aspect of the present application;
[0037] Figure 5 This is a flowchart of another file downloading method provided in an embodiment of the present application;
[0038] Figure 6 This is a structural diagram of a file downloading device provided by an embodiment of the first aspect of the present application;
[0039] Figure 7 This is a structural diagram of a file downloading device provided by an embodiment of the second aspect of the present application;
[0040] Figure 8 This is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0041] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is merely to provide a better understanding of the present application by illustrating the examples of the present application.
[0042] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, the elements defined by the phrase "comprising..." do not exclude the presence of other identical elements in the process, method, article, or device comprising the elements.
[0043] The acquisition, storage, use, and processing of data in this application's technical solution comply with relevant national laws and regulations.
[0044] The current object storage service authentication method involves querying user permissions when downloading files, either by saving user information or through a callback interface. However, this authentication method, which saves user information in the object storage service, makes the object storage service dependent on applications, making it unsuitable for other applications as a public service. This also increases application development complexity and costs. The callback interface method, which queries user download permissions, requires the object storage service to request the application and wait for a response. This results in lengthy service response times, which degrades the performance of the object storage service.
[0045] In order to solve the problems of the prior art, the embodiments of the present application provide a file downloading method, device, equipment, medium and product.
[0046] The file downloading method provided by the embodiment of the present application is described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.
[0047] Figure 1 This is a flowchart of the file download process in the file download method provided in the embodiment of the present application.
[0048] like Figure 1 As shown, the application terminal device involved in the embodiment of the present application may include an application client, and the application client may be an application service page. The object storage cloud service system may be a public service system that provides file transfer for applications, and a cache database is provided in the object storage cloud service system. The application server may be a server corresponding to the application terminal device. The object storage cloud service system receives a cache request for a user downloadable file list sent by the application server, and in response to the cache request, associates the user identifier and the user downloadable file list in the cache request and stores it in the cache database. The object storage cloud service system receives a first file download request for a target file sent by the application terminal device, and in response to the first file download request, obtains the user downloadable file list from the cache database according to the user identifier, and in the case where the user downloadable file list includes the target file identifier, obtains the target file, and sends the target file to the application terminal device.
[0049] Figure 2 This is a flowchart of a file download method provided by an embodiment of the first aspect of the present application. The file download method can be applied to an object storage cloud service system, in which a cache database is provided.
[0050] like Figure 2 As shown, the file downloading method may specifically include the following steps:
[0051] S210: Receive a cache request for a user downloadable file list sent by an application server, where the cache request includes a user identifier and the user downloadable file list, wherein the user downloadable file list includes a file identifier of at least one downloadable file corresponding to the user identifier;
[0052] S220 , in response to the cache request, associating the user identifier with the user's downloadable file list and storing it in the cache database;
[0053] S230: Receive a first file download request for a target file sent by an application terminal device, where the first file download request includes a user identifier and a target file identifier corresponding to the target file;
[0054] S240: In response to the first file download request, obtain a list of user downloadable files from a cache database according to the user identifier;
[0055] S250: When the user downloadable file list includes the target file identifier, the target file is acquired and sent to the application terminal device.
[0056] Therefore, the user identifier and the user's downloadable file list are associated and stored in a cache database set up in the object storage cloud service system. When the user downloads the target file, the object storage cloud service system queries the user's downloadable file list cached in the cache database based on the user identifier. If the user's downloadable file list contains the target file identifier, the obtained target file is sent to the application terminal device. When the user downloads a file, the cache database is used to cache the user's downloadable file list, which is simple to transform and has low application development complexity, greatly saving costs. In addition, the cache database is used to authenticate file downloads based on the user identifier. After determining that the user has download permission, the target file is provided to the user. File download authentication is separated from file downloading, reducing calls to the application backend, reducing service response time, and improving service performance.
[0057] The specific implementation methods of the above steps are introduced below.
[0058] In some embodiments, in S210, the user identifier included in the cache request may be, for example, a number identifier corresponding to the user assigned by the application server. The user downloadable list may include a file identifier corresponding to at least one file that the user has permission to download, wherein the file identifier corresponds to the user identifier and may be an identifiable identifier corresponding to the file, such as a file name.
[0059] In some embodiments, in S220, the cache database involved in the embodiments of the present application may be a storage system, for example, a redis storage system.
[0060] In some embodiments, the above S220 may specifically include:
[0061] Get the downloadable file according to the file identifier;
[0062] The user ID, the user downloadable file list and the downloadable files are associated and stored in a cache database.
[0063] In some embodiments, the object storage cloud service system caches the downloadable file corresponding to the file identifier of at least one downloadable file in the user's downloadable file list based on the file identifier of the file, and then associates the cached downloadable file with the user identifier and the user's downloadable file list and stores it in the cache database.
[0064] As an example, after the object storage cloud service system receives a cache request for a user's downloadable file list sent by an application server, it caches and downloads the user's downloadable files based on the user ID in the cache request and the file ID of the downloadable file in the user's downloadable file list. After the user's downloadable files are cached, a collection interface can be set in the cache database, and the user ID, the user's downloadable file list and the user's downloadable files can be associated and stored according to the set collection interface.
[0065] Thus, the user identification, the user's downloadable file list, and the downloadable files are associated through the cache database, and the user can be authenticated based on the user identification when the user downloads the file.
[0066] In some embodiments, to increase the security of user file downloads, the cache request also includes a validity period corresponding to the user identifier. Based on this, the method may further include:
[0067] According to the validity period corresponding to the user ID, the validity period corresponding to the user's downloadable file list is set in the cache database;
[0068] When the system time reaches the valid time, the list of user downloadable files is deleted from the cache database.
[0069] In some embodiments, the validity period corresponding to the user identifier may be, for example, the validity period set by the application server for the user identifier.
[0070] As an example, in the cache data, the user downloadable file list can be set according to the valid time of the user identifier. After the system time reaches the set valid time, the cache database will delete the cached user downloadable file list.
[0071] Therefore, the cache database sets an effective time for the user's downloadable file list, and after the set effective time is reached, the user's downloadable file list is deleted from the cache database, thereby increasing the security of the user's downloading of files.
[0072] Based on this, in some embodiments, after the above S220, the method may further include:
[0073] Send feedback information to the application server, where the feedback information includes a cache success flag or a cache failure flag.
[0074] In some embodiments, the feedback information involved in the embodiments of the present application may be, for example, feedback on cache status information of a cache database in response to a cache request, and the cache status of the cache database may be success or failure.
[0075] As an example, after the object storage cloud service system caches data in response to a cache request based on the cache database, it will send feedback information to the application server based on the cache database's cache status. If the cache database's cache status is successful, the system will send feedback information including a cache success flag to the application server; if the cache database's cache status is failed, the system will send feedback information including a cache failure flag to the application server.
[0076] Therefore, by sending feedback information to the application server, the application server can feed back the cache status to the application terminal device according to the cache status information in the feedback information.
[0077] In some embodiments, in S230, the first file download request involved in the embodiments of the present application may be a file download request for a target file sent by the application terminal device to the object storage cloud service system after receiving feedback information including a cache success flag. The target file may, for example, be a file corresponding to a file identifier of a downloadable file in the user's downloadable file list. The target file identifier corresponding to the target file may, for example, be an identifiable identifier corresponding to the target file, such as the file name of the target file.
[0078] In some embodiments, in S240, the object storage cloud service system responds to the first file download request, queries the cache database according to the user identifier, obtains the user downloadable file list from the cache database, and checks whether the file identifier corresponding to the target file is in the user downloadable file list.
[0079] In some embodiments, in S250, the object storage cloud service system queries the cache database according to the user identifier, checks that the user's downloadable file list includes the target file identifier, obtains the target file, and sends the target file to the application terminal device.
[0080] In order to improve the service performance of the object storage cloud service system, the embodiment of the present application also provides another embodiment of the file download method. Figure 3 As shown, the method may further include:
[0081] S310: Receive a cache request for a user downloadable file list sent by an application server, wherein the cache request includes a user identifier and the user downloadable file list, wherein the user downloadable file list includes a file identifier of at least one downloadable file corresponding to the user identifier;
[0082] S320: In response to the cache request, associate the user identifier with the user downloadable file list and store them in the cache database;
[0083] S330: Receive a first file download request for a target file sent by an application terminal device, where the first file download request includes the user identifier and a target file identifier corresponding to the target file;
[0084] S340: In response to the first file download request, obtain the user downloadable file list from the cache database according to the user identifier;
[0085] S350: If the target file identifier is not included in the user downloadable file list, reject the first file download request;
[0086] S360: Record the cumulative number of download failures corresponding to the user ID.
[0087] The above S310 - S330 are the same as the above S210 - S230 and will not be described in detail here for the sake of brevity.
[0088] In some embodiments, in S350, the object storage cloud service system queries the cache database according to the user identifier and checks that the user's downloadable file list does not include the target file identifier, and then rejects the user's download request.
[0089] In some embodiments, in S360, a cumulative download failure coefficient corresponding to the user identifier is set in the object storage cloud service system. After the user requests to download and is denied downloading a file, the object storage cloud service system will record the number of download failures corresponding to the user identifier plus 1 to obtain the cumulative number of download failures.
[0090] Based on this, in some embodiments, the above S340 may specifically include:
[0091] Get the cumulative number of download failures corresponding to the user ID;
[0092] When the cumulative number of download failures does not exceed a preset threshold, a list of downloadable files for the user is obtained from the cache database according to the user ID;
[0093] When the cumulative number of download failures exceeds a preset threshold, the file download request corresponding to the user identifier is rejected within a preset time period.
[0094] In some embodiments, the preset threshold involved in the embodiments of the present application can be, for example, a preset maximum number of cumulative download failures, and the preset duration can be, for example, the duration during which the user is no longer allowed to download files after the user's cumulative download failures exceed the preset threshold.
[0095] As an example, in response to a first file download request sent by an application terminal device, the object storage cloud service system first obtains the cumulative number of download failures corresponding to the user ID based on the user ID. If the cumulative number of download failures does not exceed a preset threshold, the system obtains a list of downloadable files for the user from a cache database and queries the user for download permissions. If the cumulative number of download failures exceeds the preset threshold, the system rejects the file download request corresponding to the user ID for a certain period of time based on a preset duration.
[0096] Therefore, the list of downloadable files in the cache database is queried through the user ID. If the target file ID is not included in the user's downloadable file list, the file download request is rejected, and the cumulative number of download failures corresponding to the user ID is recorded. The user's download request is restricted based on whether the cumulative number of download failures exceeds the preset threshold, providing security for user downloads and effectively reducing users' malicious downloading of files.
[0097] Figure 4 This is a flowchart of a file download method provided in the second embodiment of the present application. The file download method can be applied to an application server.
[0098] like Figure 4 As shown, the file downloading method may specifically include the following steps:
[0099] S410: Receive a second file download request sent by an application terminal device, where the second file download request includes a user identifier of a target user and a file identifier corresponding to at least one file, where the target user is a user logged in to the application terminal device;
[0100] S420: In response to the second file download request, query the target user's download authority for at least one file according to the user identifier to obtain a query result;
[0101] S430: If the query result indicates that the target user has download permission, generate a list of user-downloadable files based on the file identifier corresponding to at least one file;
[0102] S440: Send a cache request for the user's downloadable file list to the object storage cloud service system.
[0103] Thus, by receiving a second file download request sent by an application terminal, the target user logged in at the application terminal is queried for file download permissions based on the user identifier in the second file download request and the file identifier corresponding to at least one file. If the query result indicates that the target user has download permissions, a user downloadable file list is generated based on the file identifier, and a cache request for the user downloadable file list is sent to the object storage cloud service system. Thus, when a user downloads a file, the file download permissions are queried for the user based on the user identifier, and if the user has permissions, a user downloadable file list is generated for the user. By caching the user downloadable file list in a cache database in the object storage cloud service system, the cache database is used to perform authentication when the user downloads files. This simplifies the transformation, reduces the complexity of application development, and significantly saves costs.
[0104] In some embodiments, in S410, the second file download request involved in the embodiments of the present application may be used to instruct the application server to query whether the target user has the permission to download the file based on the user identifier and the file identifier corresponding to at least one file. The target user may be a user logged in to the application terminal device.
[0105] In some embodiments, in S420, the application server responds to the second file download request and queries the target user's download permission for at least one file based on the user identifier to obtain a query result, where the query result may be that the target user has download permission or that the target user does not have download permission.
[0106] In some embodiments, in S430, if the application server finds that the user has download permission, the application server generates a list of user downloadable files based on the file identifier corresponding to at least one file. If the application server finds that the user does not have download permission, the application server fails to generate the list of user downloadable files.
[0107] In some embodiments, in S440 , after generating the user downloadable file list, the application server sends a cache request for the user downloadable file list to the object storage cloud service system.
[0108] In some embodiments, after the above S440, the method may further include:
[0109] Receive feedback information sent by the object storage cloud service system;
[0110] Send feedback information to the application terminal device.
[0111] As an example, after receiving a second file download request from an application terminal device, the application server queries the target user's download permissions based on the user identifier and the file identifier corresponding to at least one file in the second download request, and generates a user-downloadable file list based on the file download query result. Based on the generated user-downloadable file list and the user identifier, the application server sends a cache request to the object storage cloud service system. After receiving feedback information including the cache status from the object storage cloud service system, the application server sends the feedback information to the application terminal device.
[0112] When the cache status is successful, feedback information including a cache success flag is sent to the application terminal device; when the cache status is failed, feedback information including a cache failure flag is sent to the application terminal device. When the application terminal device receives the cache success flag, it sends a file download request to the object storage cloud service system; when the application terminal device receives the cache failure flag, it does not initiate a file download request.
[0113] Therefore, by sending feedback information to the application terminal device, when the application terminal device receives a cache failure flag, it does not initiate a file download request, which can reduce the call of the object storage cloud service system and improve service performance.
[0114] In order to facilitate the authentication of user file downloads, the present application embodiment also provides another embodiment of the file download method. Figure 5 As shown, before the above S410, the method may further include:
[0115] S510: Assign a user ID to the target user when the target user logs in.
[0116] Based on this, after the above S510, the method may further include:
[0117] Set the valid time corresponding to the user ID.
[0118] As an example, after the target user logs in to the application terminal, the application server allocates a user ID to the target user and sets a valid time corresponding to the user ID. During the valid time, the user downloads files based on the allocated user ID.
[0119] Therefore, by allocating a user ID to the target user when the target user logs in and setting a valid time for the user ID, it is convenient to authenticate the target user's file download based on the user ID when the target user downloads the file.
[0120] It should be noted that the application scenarios described in the above-mentioned embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Ordinary technicians in this field can know that with the emergence of new application scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.
[0121] Based on the same inventive concept, this application also provides a file downloading device. Figure 6 Provide detailed explanation.
[0122] Figure 6 This is a schematic diagram of the structure of a file downloading device provided by an embodiment of the first aspect of the present application. The file downloading device can be applied to an object storage cloud service system, in which a cache database is provided.
[0123] like Figure 6 As shown, the file downloading device 600 may include:
[0124] A first receiving module 601 is configured to receive a cache request for a user downloadable file list sent by an application server, the cache request including a user identifier and a user downloadable file list, wherein the user downloadable file list includes a file identifier of at least one downloadable file corresponding to the user identifier;
[0125] A first response module 602 is configured to associate the user identifier with the user's downloadable file list and store it in a cache database in response to the cache request;
[0126] The second receiving module 603 is configured to receive a first file download request for a target file sent by an application terminal device, where the first file download request includes a user identifier and a target file identifier corresponding to the target file;
[0127] The second response module 604 is configured to respond to the first file download request and obtain a list of user downloadable files from the cache database according to the user identifier;
[0128] The acquisition module 605 is configured to acquire the target file if the target file identifier is included in the user downloadable file list, and send the target file to the application terminal device.
[0129] The file downloading device 600 is described in detail below.
[0130] In some embodiments, the file downloading device 600 may further include:
[0131] a request rejection module, configured to reject the first file download request if the target file identifier is not included in the user's downloadable file list;
[0132] The recording module is used to record the cumulative number of download failures corresponding to the user ID.
[0133] In some embodiments, the second response module 604 may specifically include:
[0134] The first acquisition submodule is used to obtain the cumulative number of download failures corresponding to the user identifier;
[0135] The second acquisition submodule is used to obtain a list of downloadable files for the user from the cache database according to the user identifier when the cumulative number of download failures does not exceed a preset threshold;
[0136] The request rejection submodule is used to reject the file download request corresponding to the user identifier within a preset time period when the cumulative number of download failures exceeds a preset threshold.
[0137] In some embodiments, the first response module 602 may specifically include:
[0138] The cache submodule is used to cache downloadable files according to file identifiers;
[0139] The storage submodule is used to associate and store the user identifier, the user's downloadable file list and the downloadable files in a cache database.
[0140] In some embodiments, the cache request further includes a validity period corresponding to the user identifier. Based on this, the file downloading device 600 may further include:
[0141] A setting module, configured to set the valid time corresponding to the user's downloadable file list in the cache database according to the valid time corresponding to the user identifier;
[0142] The deletion module is used to delete the user's downloadable file list from the cache database when the system time reaches the valid time.
[0143] In some embodiments, the file downloading device 600 may further include:
[0144] The second sending module is configured to send feedback information to the application server after associating the user identifier with the user downloadable file list and storing it in the cache database in response to the cache request, wherein the feedback information includes a cache success flag or a cache failure flag.
[0145] Figure 7 This is a schematic diagram of the structure of a file downloading device provided in the second embodiment of the present application. The file downloading device can be applied to an application server.
[0146] like Figure 7 As shown, the file downloading device 700 may include:
[0147] The third receiving module 701 is configured to receive a second file download request sent by an application terminal device, the second file download request including a user identifier of a target user and a file identifier corresponding to at least one file, where the target user is a user logged in to the application terminal device;
[0148] The third response module 702 is configured to query the target user's download authority for at least one file according to the user identifier in response to the second file download request, and obtain a query result;
[0149] A generating module 703 is configured to generate a list of user-downloadable files based on a file identifier corresponding to at least one file when the query result indicates that the target user has download permission;
[0150] The first sending module 704 is configured to send a cache request for a list of user downloadable files to the object storage cloud service system.
[0151] In some embodiments, the file downloading device 700 may further include:
[0152] The allocation module is used to allocate a user identification to the target user when the target user logs in before receiving the second file download request sent by the application terminal device.
[0153] In some embodiments, the file downloading device 700 may further include:
[0154] The second setting module is used to set the validity period corresponding to the user identification after the user identification is allocated to the target user when the target user logs in.
[0155] In some embodiments, the file downloading device 700 may further include:
[0156] a fourth receiving module, configured to receive feedback information sent by the object storage cloud service system after sending a cache request for a list of user downloadable files to the object storage cloud service;
[0157] The third sending module is used to send feedback information to the application terminal device.
[0158] Therefore, the user identifier and the user's downloadable file list are associated and stored in a cache database set up in the object storage cloud service system. When the user downloads the target file, the object storage cloud service system queries the user's downloadable file list cached in the cache database based on the user identifier. If the user's downloadable file list contains the target file identifier, the obtained target file is sent to the application terminal device. When the user downloads a file, the cache database is used to cache the user's downloadable file list, which is simple to transform and has low application development complexity, greatly saving costs. In addition, the cache database is used to authenticate file downloads based on the user identifier. After determining that the user has download permission, the target file is provided to the user. File download authentication is separated from file downloading, reducing calls to the application backend, reducing service response time, and improving service performance.
[0159] Figure 8 This is a structural diagram of an electronic device provided in an embodiment of the present application.
[0160] The electronic device 800 may include a processor 801 and a memory 802 storing computer program instructions.
[0161] Specifically, the processor 801 may include a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0162] The memory 802 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 802 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 802 may include removable or non-removable (or fixed) media. Where appropriate, the memory 802 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 802 is a non-volatile solid-state memory.
[0163] In certain embodiments, the memory may include read-only memory (ROM), random access memory (RAM), magnetic disk storage media devices, optical storage media devices, flash memory devices, electrical, optical, or other physical / tangible memory storage devices. Thus, generally, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present application.
[0164] The processor 801 implements any one of the file downloading methods in the above embodiments by reading and executing computer program instructions stored in the memory 802 .
[0165] In some examples, the electronic device 800 may further include a communication interface 803 and a bus 810. Figure 8 As shown, the processor 801, the memory 802, and the communication interface 803 are connected via a bus 810 and communicate with each other.
[0166] The communication interface 803 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0167] Bus 810 includes hardware, software or both, and the components of online data flow metering equipment are coupled to each other. For example, but not limitation, bus 810 may include accelerated graphics port (AGP) or other graphics bus, enhanced industry standard architecture (EISA) bus, front side bus (FSB), hypertransport (HT) interconnection, industry standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 810 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the application considers any suitable bus or interconnection.
[0168] Illustratively, the electronic device 800 may be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA).
[0169] The electronic device 800 can execute the file download method in the embodiment of the present application, thereby realizing the combination of Figures 2 to 7 Described file downloading method and device.
[0170] In addition, in combination with the file download method in the above embodiment, the embodiment of the present application may provide a computer-readable storage medium for implementation. The computer-readable storage medium stores computer program instructions; when the computer program instructions are executed by the processor, any one of the file download methods in the above embodiment is implemented. Examples of computer-readable storage media include non-transitory computer-readable storage media, such as portable disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), portable compact disk read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, etc.
[0171] It should be understood that the present application is not limited to the specific configurations and processes described above and illustrated in the figures. For the sake of brevity, a detailed description of known methods is omitted here. In the above embodiments, several specific steps are described and illustrated as examples. However, the method process of the present application is not limited to the specific steps described and illustrated. Those skilled in the art can make various changes, modifications, and additions, or change the order of the steps after understanding the spirit of the present application.
[0172] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium that can store or transmit information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROMs, flash memories, erasable ROMs (EROMs), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0173] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps. In other words, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0174] Aspects of the present application have been described above with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present application. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine so that these instructions executed via the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. This processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit. It is also understood that each box in the block diagram and / or the flowchart and the combination of the boxes in the block diagram and / or the flowchart can also be implemented by the dedicated hardware that performs the specified function or action, or can be implemented by the combination of dedicated hardware and computer instructions.
[0175] The above description is only a specific embodiment of the present application. Those skilled in the art will clearly understand that for the convenience and brevity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the scope of protection of the present application is not limited thereto. Any person skilled in the art can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the scope of protection of the present application.
Claims
1. A file download method, applied to an object storage cloud service system, wherein the object storage cloud service system is provided with a cache database, characterized in that: include: receiving a cache request for a user downloadable file list sent by an application server, the cache request including a user identifier and the user downloadable file list, wherein the user downloadable file list includes a file identifier of at least one downloadable file corresponding to the user identifier; In response to the cache request, storing the user identifier and the user downloadable file list in association with each other in the cache database; receiving a first file download request for a target file sent by an application terminal device, wherein the first file download request includes the user identifier and a target file identifier corresponding to the target file; In response to the first file download request, obtaining the user downloadable file list from the cache database according to the user identifier; When the target file identifier is included in the user downloadable file list, acquiring the target file and sending the target file to the application terminal device; The associating and storing the user identifier and the list of downloadable files for the user in the cache database includes: caching the downloadable file according to the file identifier; According to a collection interface set in a cache database, the user identifier, the user downloadable file list and the downloadable file are associated and stored in the cache database; The cache request also includes a validity period corresponding to the user identifier, and the method further includes: According to the validity period corresponding to the user identifier, setting the validity period corresponding to the list of downloadable files for the user in the cache database; When the system time reaches the valid time, the user downloadable file list is deleted from the cache database.
2. The method according to claim 1, characterized in that The method further comprises: If the target file identifier is not included in the user downloadable file list, reject the first file download request; Record the cumulative number of download failures corresponding to the user ID.
3. The method according to claim 2, characterized in that The acquiring the list of downloadable files for the user from the cache database according to the user identifier includes: Obtain the cumulative number of download failures corresponding to the user ID; When the cumulative number of download failures does not exceed a preset threshold, obtaining a list of downloadable files for the user from the cache database according to the user identifier; When the cumulative number of download failures exceeds the preset threshold, the file download request corresponding to the user identifier is rejected within a preset time period.
4. The method according to claim 1, wherein After the user identifier and the list of user downloadable files are stored in the cache database in association with each other in response to the cache request, the method further includes: Sending feedback information to the application server, wherein the feedback information includes a cache success flag or a cache failure flag.
5. A file downloading method, applied to an application server, characterized in that: include: receiving a second file download request sent by an application terminal device, the second file download request including a user identifier of a target user and a file identifier corresponding to at least one downloadable file, the target user being a user logged in to the application terminal device; In response to the second file download request, querying the target user's download authority for the at least one downloadable file according to the user identifier to obtain a query result; If the query result indicates that the target user has the download permission, generating a user downloadable file list according to the file identifier corresponding to the at least one downloadable file; Sending a cache request for the user's downloadable file list to an object storage cloud service system, wherein the object storage cloud service system is provided with a cache database; After caching the downloadable file according to the file identifier, the object storage cloud service system associates the user identifier, the user downloadable file list, and the downloadable file and stores them in the cache database according to the collection interface set in the cache database; The cache request also includes a validity period corresponding to the user identifier, and the method further includes: The object storage cloud service system sets the valid time corresponding to the user downloadable file list in the cache database according to the valid time corresponding to the user identifier; When the system time reaches the valid time, the object storage cloud service system deletes the user downloadable file list from the cache database.
6. The method according to claim 5, characterized in that Before receiving the second file download request sent by the application terminal device, the method further includes: The user ID is allocated to the target user when the target user logs in.
7. The method according to claim 6, characterized in that After allocating the user identifier to the target user when the target user logs in, the method further includes: Set the validity period corresponding to the user ID.
8. The method according to claim 5, characterized in that After sending a cache request for the user downloadable file list to the object storage cloud service system, the method further includes: Receiving feedback information sent by the object storage cloud service system; Sending the feedback information to the application terminal device.
9. A file downloading device, applied to an object storage cloud service system, wherein the object storage cloud service system is provided with a cache database, characterized in that: The device comprises: a first receiving module, configured to receive a cache request for a user downloadable file list sent by an application server, the cache request including a user identifier and the user downloadable file list, wherein the user downloadable file list includes a file identifier of at least one downloadable file corresponding to the user identifier; A first response module, configured to associate the user identifier with the user downloadable file list and store them in the cache database in response to the cache request; a second receiving module, configured to receive a first file download request for a target file sent by an application terminal device, wherein the first file download request includes the user identifier and a target file identifier corresponding to the target file; a second response module, configured to respond to the first file download request and obtain the user downloadable file list from the cache database according to the user identifier; An acquisition module, configured to acquire the target file and send the target file to the application terminal device when the target file identifier is included in the user downloadable file list; The associating and storing the user identifier and the list of downloadable files for the user in the cache database includes: caching the downloadable file according to the file identifier; According to a collection interface set in a cache database, the user identifier, the user downloadable file list and the downloadable file are associated and stored in the cache database; The cache request also includes a valid time corresponding to the user identifier, and the file downloading device further includes: A setting module, configured to set the valid time corresponding to the list of downloadable files of the user in the cache database according to the valid time corresponding to the user identifier; The deleting module is configured to delete the user downloadable file list from the cache database when the system time reaches the valid time.
10. A file downloading device, applied to an application server, characterized in that: The device comprises: a third receiving module, configured to receive a second file download request sent by an application terminal device, wherein the second file download request includes a user identifier of a target user and a file identifier corresponding to at least one downloadable file, wherein the target user is a user logged in to the application terminal device; a third response module, configured to query the target user's download authority for the at least one downloadable file according to the user identifier in response to the second file download request, and obtain a query result; A generating module, configured to generate a user downloadable file list according to a file identifier corresponding to the at least one downloadable file if the query result indicates that the target user has the download permission; A first sending module is configured to send a cache request for the user downloadable file list to an object storage cloud service system, wherein the object storage cloud service system is provided with a cache database; After caching the downloadable file according to the file identifier, the object storage cloud service system associates the user identifier, the user downloadable file list, and the downloadable file and stores them in the cache database according to the collection interface set in the cache database; The cache request also includes a valid time corresponding to the user identifier. The object storage cloud service system sets a valid time corresponding to the user downloadable file list in the cache database based on the valid time corresponding to the user identifier; when the system time reaches the valid time, the object storage cloud service system deletes the user downloadable file list from the cache database.
11. An electronic device, characterized in that: The device includes: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the steps of the file downloading method according to any one of claims 1-4 or 5-8 are implemented.
12. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer program instructions, which, when executed by a processor, implement the steps of the file downloading method according to any one of claims 1 to 4 or 5 to 8.
13. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the steps of the file downloading method according to any one of claims 1 to 4 or 5 to 8.
Citation Information
Patent Citations
Resource downloading method and caching device
CN106254528A
Data transmission method and device among multiple network environments, equipment and storage medium
CN111131220A
Resource access authentication method and device, storage medium and electronic equipment
CN112995166A