[go: up one dir, main page]

CN119597350A - Command execution result acquisition method and device, computer equipment and storage medium - Google Patents

Command execution result acquisition method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN119597350A
CN119597350A CN202411419846.9A CN202411419846A CN119597350A CN 119597350 A CN119597350 A CN 119597350A CN 202411419846 A CN202411419846 A CN 202411419846A CN 119597350 A CN119597350 A CN 119597350A
Authority
CN
China
Prior art keywords
target
command
execution
execution command
cache file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202411419846.9A
Other languages
Chinese (zh)
Inventor
程康
杨旭荣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sangfor Technologies Co Ltd
Original Assignee
Sangfor Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sangfor Technologies Co Ltd filed Critical Sangfor Technologies Co Ltd
Priority to CN202411419846.9A priority Critical patent/CN119597350A/en
Publication of CN119597350A publication Critical patent/CN119597350A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline or look ahead
    • G06F9/3802Instruction prefetching
    • G06F9/3808Instruction prefetching for instruction reuse, e.g. trace cache, branch target cache
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请公开了一种命令执行结果的获取方法、装置、计算机设备及存储介质,该命令执行结果的获取方法包括:响应于待执行的目标执行命令,确定所述目标执行命令对应的目标缓存文件;从所述目标缓存文件中获取所述目标执行命令对应的历史执行结果,作为本次执行所述目标执行命令的执行结果。本方法将执行命令的历史执行结果缓存在缓存文件里,在执行待执行的目标执行命令之前,无需执行目标执行命令,只需确定目标执行命令对应的目标缓存文件,即可获取目标执行命令对应的历史执行结果,来作为本次执行命令的执行结果,以减少目标执行命令的执行次数,以减少对计算机设备的资源占用,并提升执行命令的执行效率。

The present application discloses a method, device, computer equipment and storage medium for obtaining command execution results. The method for obtaining command execution results includes: in response to a target execution command to be executed, determining a target cache file corresponding to the target execution command; obtaining the historical execution result corresponding to the target execution command from the target cache file as the execution result of the current execution of the target execution command. The method caches the historical execution results of the execution command in a cache file. Before executing the target execution command to be executed, there is no need to execute the target execution command. It is only necessary to determine the target cache file corresponding to the target execution command to obtain the historical execution result corresponding to the target execution command as the execution result of the current execution command, so as to reduce the number of executions of the target execution command, reduce the resource occupation of the computer equipment, and improve the execution efficiency of the execution command.

Description

Command execution result acquisition method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and apparatus for obtaining a command execution result, a computer device, and a storage medium.
Background
In the related art, after a command to be executed is obtained, an original command is directly executed by a computer device to obtain an execution result. However, for commands whose command execution results are updated at a low frequency, since the execution results of these commands are not generally changed, the computer meaninglessly executes a large number of commands, and thus resources in the computer are wasted.
Disclosure of Invention
In view of the above, the present application provides a method, apparatus, computer device and storage medium for obtaining a command execution result.
In a first aspect, an embodiment of the present application provides a method for obtaining a command execution result, where the method includes determining, in response to a target execution command to be executed, a target cache file corresponding to the target execution command, and obtaining, from the target cache file, a historical execution result corresponding to the target execution command as an execution result of executing the target execution command at this time.
In a second aspect, an embodiment of the present application provides a device for obtaining a command execution result, where the device includes a target cache file determining module, configured to determine, in response to a target execution command to be executed, a target cache file corresponding to the target execution command, and an execution result obtaining module, configured to obtain, from the target cache file, a historical execution result corresponding to the target execution command, as an execution result of executing the target execution command at this time.
In a third aspect, an embodiment of the present application provides a computer device, where the computer device includes one or more processors, a memory, and one or more application programs, where the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more program is configured to perform the method for obtaining the command execution result provided in the first aspect.
In a fourth aspect, an embodiment of the present application provides a computer readable storage medium having stored therein program code that is capable of being invoked by a processor to execute the method for obtaining the command execution result provided in the first aspect.
According to the scheme provided by the application, the historical execution result of the execution command is cached in the cache file, before the target execution command to be executed is executed, the target execution command is not required to be executed, and the historical execution result corresponding to the target execution command can be obtained as the execution result of the current execution command only by determining the target cache file corresponding to the target execution command, so that the execution times of the target execution command are reduced, the occupation of resources of computer equipment is reduced, and the execution efficiency of the execution command is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart illustrating a method for obtaining a command execution result according to an embodiment of the present application.
Fig. 2 is a flowchart of a method for obtaining a command execution result according to another embodiment of the present application.
Fig. 3 shows a schematic diagram of a memory structure in an embodiment of the application.
Fig. 4 is a schematic diagram showing updating of a command execution result in the method for obtaining a command execution result according to the embodiment of the present application.
Fig. 5 is a hardware schematic diagram of a method for obtaining a command execution result in an embodiment of the present application.
Fig. 6 is a flowchart of a method for obtaining a command execution result according to still another embodiment of the present application.
Fig. 7 is a flowchart of a method for obtaining a command execution result according to still another embodiment of the present application.
Fig. 8 shows a comparison result between a storage usage rate corresponding to the method for obtaining a command execution result according to the embodiment of the present application and a storage usage rate of a command execution result in the related art.
Fig. 9 is a block diagram showing a configuration of a command execution result acquisition apparatus according to an embodiment of the present application.
Fig. 10 is a block diagram of a computer device for executing the method for acquiring the command execution result according to the embodiment of the present application.
Fig. 11 illustrates a storage medium for storing or carrying program code for implementing a method of acquiring a command execution result according to an embodiment of the present application.
Detailed Description
In order to enable those skilled in the art to better understand the present application, the following description will make clear and complete descriptions of the technical solutions according to the embodiments of the present application with reference to the accompanying drawings.
In the related art, the execution frequency of a command is reduced as much as possible by searching for a service that has an excessively high execution frequency and has a large influence on the execution frequency of the command from the service layer. However, the service is updated continuously, and if the service with too high frequency of executing command and larger influence is searched for each time of updating the service, the workload of service personnel is increased, so that the mode has poor universality. And, the Input/output read/write rate (Input/Output Operations Per Second, IOPS) corresponding to the software or hardware is lowered.
Moreover, when commands are executed, these commands are communicated directly with hardware or software and issue Non-native command sequence (Non-Native Command Queuing, non-NCQ) instructions, which not only increase the load of the hardware or software, but may also cause the native command sequence (Native Command Queuing, NCQ) instructions to reorder, which in turn severely affects Input/Output (IO).
Aiming at the problems in the background technology, the inventor provides a method, a device, computer equipment and a storage medium for acquiring a command execution result. The historical execution results of the execution commands are cached in the cache files, before the target execution commands to be executed are executed, the target execution commands are not required to be executed, the historical execution results corresponding to the target execution commands can be obtained as the execution results of the execution commands at this time only by determining the target cache files corresponding to the target execution commands, so that the execution times of the target execution commands are reduced, the occupation of resources of computer equipment is reduced, the execution efficiency of the execution commands is improved, meanwhile, the execution commands are not required to be searched, the workload of service personnel is not required to be increased, and the universality of the acquisition of the execution results is improved.
The method, apparatus, computer device and storage medium for obtaining command execution results provided in the embodiments of the present application will be described in detail below with reference to the accompanying drawings.
Referring to fig. 1, fig. 1 is a flowchart illustrating a method for obtaining a command execution result according to an embodiment of the present application. The command execution result acquisition method can be applied to the command execution result acquisition device 300 shown in fig. 9 and the computer apparatus 100 (fig. 10) provided with the command execution result acquisition device 300.
The method for acquiring the command execution result specifically comprises the following steps:
Step S110, responding to a target execution command to be executed, and determining a target cache file corresponding to the target execution command.
Wherein, executing the command refers to inputting, generating or reading the command according to a specific format or syntax in a computer, an operating system, a software application or a command line interface, and then letting the computer or the system execute the command to complete the task or operation. The execution commands include, but are not limited to, hardware commands, software commands, and the like. The target execution command to be executed refers to an execution command that has been determined but not executed by the computer or system.
The target cache file is a file in which information related to a target execution command is stored. For example, the target cache file includes, but is not limited to, execution software information, execution hardware information, and execution results corresponding to the target execution command.
In the embodiment of the application, the target cache file is determined in response to the target execution command to be executed, and the mapping relationship between the target execution command and the target cache file can be established first, so that the target cache file corresponding to the target execution command can be determined according to the mapping relationship. And a mapping relation can be established between the target execution command and the storage path of the target cache file, and after the target execution command is determined, the storage path corresponding to the target execution command can be determined according to the mapping relation, and then the target cache file is determined according to the storage path. The manner of determining the target cache file according to the target execution command to be executed may be set according to actual situations, and is not specifically limited herein.
Step S120, obtaining a history execution result corresponding to the target execution command from the target cache file, as an execution result of executing the target execution command at this time.
The historical execution result can be an execution result obtained after the target execution command is executed last time. Or the execution result obtained after the target execution command is executed after the execution event corresponding to the target execution command is changed. The execution result obtained after the target execution command is executed at the preset frequency may also be obtained. It should be noted that, the target cache file may include all the historical execution results of the target execution command, or may include only the latest historical execution result, and the number of the historical execution results in the cache file is not specifically limited.
In the embodiment of the application, the historical execution result of the target execution command is obtained from the target cache file, the latest historical execution result is obtained, the historical execution result is used as the execution result of the current execution target execution command, and the target execution command does not need to be executed again.
According to the scheme provided by the embodiment, the historical execution results of the execution command are cached in the cache file, before the target execution command to be executed is executed, the target execution command is not required to be executed, the historical execution results corresponding to the target execution command can be obtained only by determining the target cache file corresponding to the target execution command and used as the execution results of the execution command, so that the execution times of the target execution command are reduced, the occupation of resources of computer equipment is reduced, the execution efficiency of the execution command is improved, meanwhile, the execution command is not required to be searched, the workload of service personnel is not required to be increased, and the universality of the acquisition of the execution result is improved.
Referring to fig. 2, fig. 2 is a flowchart illustrating a method for obtaining a command execution result according to another embodiment of the application.
And step S210, responding to the acquired target service, and acquiring the target execution command carried by the target service.
The target service may be obtained by determining an operation in response to a selection of a user in a man-machine interaction device, which includes but is not limited to a terminal device, a computer device, and other devices with an interaction function. The selection determination operation includes, but is not limited to, a click determination operation, a drag determination operation, an input operation, and the like, and the man-machine interaction device and the selection determination operation are not particularly limited herein.
Further, the acquiring manner of the target execution command carried by the target service may be that the target service is parsed according to a preset parsing manner, so as to acquire the target execution command carried by the target service. The method can also be used for acquiring keywords in the target service and determining a target execution command corresponding to the target service according to the keywords. The specific acquisition mode of the target execution command carried by the acquisition target service is not limited herein.
Illustratively, the target execution command is determined according to the keywords in the target service. The obtained target service is the disk state of inquiring disk id 1, and the keywords in the target service are the inquiry, id 1 and disk state. From the key, the target execution command is determined to be SEARCH SCSI _id=1.
Step S220, determining a target inquiry command corresponding to the target execution command according to the target execution command.
The target query command may be a target query command determined according to the target cache file after determining the target cache file corresponding to the target execution command according to the target execution command. And the soft link command of the target execution command can also be used for pointing to the target cache file corresponding to the target execution command. A soft link, also called symbolic link, is in fact a file that contains the pathname of another file. Soft links may point to any file or directory, even files that can link different file systems. That is, when the target query command is located at the soft link of the target execution command, the target query command includes the pathname of the target cache file, so as to implement the query of the execution result corresponding to the target execution command.
Illustratively, the target execution command test is renamed to test. And the created soft link test is used as a target query instruction corresponding to the target execution command. For replacing test commands.
In some embodiments, determining the target query command corresponding to the target execution command according to the target execution command comprises replacing an original name of the target execution command with a target name, and establishing the target query command corresponding to the target execution command, wherein the name of the target query command is the original name.
In the embodiment of the application, in order to ensure that the user accesses the target service, the execution target execution command carried by the target service.
And step S230, executing the target inquiry command, and determining a target cache file corresponding to the target execution command from the cached files.
In the embodiment of the application, because the target query command includes the path name of the target cache file, when the target query command is executed, the target cache file corresponding to the target execution command can be determined from the cached files.
In some embodiments, caching of the cached files is achieved through a plug-in mode. The plug-in mode includes, but is not limited to, file storage backend, distributed key value pair (etcd) storage backend, and other storage modes. The file storage backend refers to a storage backend based on a file system, and is also a default storage backend. So that it uses a file directory as a storage directory, and each different command's cache uses a separate file storage and is named in a specific naming format. The distributed key-value pair storage backend refers to a storage backend based on distributed key-value pairs, designed to reliably store and retrieve data, and provide high availability and consistency guarantees.
Referring to fig. 3, fig. 3 is a schematic diagram of a memory structure according to an embodiment of the application. And determining a storage position corresponding to each cache file according to the resource identifier corresponding to the cache file, determining the storage position corresponding to the resource identifier according to the resource type to which the resource identifier belongs, and finally managing and controlling all the resource types by the root directory to realize the caching of the cache file.
Step 240, obtaining a history execution result corresponding to the target execution command from the target cache file, and taking the history execution result as an execution result of executing the target execution command at this time.
The detailed description of step S240 refers to step S120 in the foregoing embodiment, and is not repeated here.
And step S250, updating the historical execution result in the target cache file in response to the monitored change of the target event corresponding to the target execution command.
In the embodiment of the application, in order to ensure timeliness and accuracy of the historical execution result, the target event corresponding to each execution command is monitored, and when the target event changes, the historical result is updated according to the change of the target event. When the target event changes, the target execution command can be executed in time to obtain the latest historical execution result after the target event changes.
Illustratively, when the disk sda device is monitored, the relevant changes of the target event are immediately sent to the outside. If the sda device is pulled off, the storage path associated with the sda device is deleted, and cache data and files associated with the sda device are cleaned up. If the sda device is inserted, the storage path associated with the sda device is updated, and the associated cache data and file are updated.
In some embodiments, the method for updating the historical execution result in the target cache file may also be to use a polling mechanism to detect whether the target event changes, and update the data and the file of the target event in time after detecting that the target event changes.
For example, the status of the disk array raid card 0 queried at 10 o ' clock is ok, and the status of the raid card 0 queried at 10 o ' clock 1 o ' clock is bad, which indicates that the status of the raid card 0 changes, and then related data and files corresponding to the raid card 0 need to be updated.
In other embodiments, the cache validity period of the execution result corresponding to the target event may be monitored in real time, and when the cache of the execution result has expired, the target execution command is executed to update the execution result. It should be noted that the buffer validity period is greater than the execution frequency of the target execution command, so as to achieve a lower update frequency than the execution frequency, and improve and reduce the execution times of the target execution command.
For example, the cache validity period of the execution result of the target event 1 is 10 days, and after the cache validity period is reached, the target execution command is executed to update the execution result corresponding to the target event 1.
Referring to fig. 4, fig. 4 is a schematic diagram illustrating updating of a command execution result in the method for obtaining a command execution result according to the embodiment of the present application. The event listeners, pollers and cache expiration scanners collectively listen for multiple events. When the event meeting the corresponding condition exists, a buffer memory to be updated is allocated for each event to be updated, and the buffer memory to be updated is added into a task queue, so that the update of the buffer memory file corresponding to the event to be updated is realized through a buffer memory refreshing thread, and the execution result of the target execution command is updated. It is necessary to mainly update the cache in series through the deduplication task queue and a single task (worker) in order to reduce the influence on the whole system to the greatest extent in the embodiment of the application, so that only one command is in an operation state at the same time. Multiple tasks may also be configured as needed to speed up the cache update process.
In a specific implementation process, a history execution result is cached in a cache file through a caching tool (cached-tool), a multi-level caching mode of a cache warehouse (cache store) is utilized for caching, and a cache refresh device (CACHE REFRESHER) is combined for refreshing the history execution result, so that when a target service is generated, an execution result obtained by a target execution command corresponding to the target service is the latest execution result, and timeliness of the acquisition of the execution result is ensured.
Referring to fig. 5, fig. 5 is a hardware schematic diagram illustrating a method for obtaining a command execution result in an embodiment of the application. In fig. 5, a cache tool is first utilized to establish a query command according to an execution command, and a correspondence between the query command and a cache repository is established, and the cache repository updates a historical execution result according to a cache flusher. When an execution command corresponding to a service required by a user is acquired, the corresponding historical execution result in the cache warehouse is directly acquired through the query command to serve as the execution result of the time, so that the execution of the execution command is reduced, and the efficiency of acquiring the execution result is improved.
According to the scheme provided by the embodiment, the corresponding target query command is established according to the target execution command, so that the target cache file corresponding to the target execution command is queried according to the target query command, and further, the historical execution result in the target cache file is obtained to be used as the execution result of the host vehicle execution target execution command, the execution action is replaced by the query action, the target execution command is not required to be executed, the execution times of the target execution command are further reduced, meanwhile, the load of software or hardware is also reduced, meanwhile, the service is transparent, no modification is required to the service, no worry about negative influence on the function is required, and service developers do not need to worry about repeated introduction of the same problem.
Referring to fig. 6, fig. 6 is a flowchart illustrating a method for obtaining a command execution result according to another embodiment of the application.
And step S310, responding to the acquired target service, and acquiring the target execution command carried by the target service.
Step S320, determining a target inquiry command corresponding to the target execution command according to the target execution command.
The detailed description of steps S310-S320 is referred to steps S210-S220 in the foregoing embodiments, and will not be repeated here.
Step S330, obtaining the command type corresponding to the target inquiry command.
Wherein the command types include, but are not limited to, cacheable types and non-cacheable types. The determining of the command type can be determined according to the parameters of the target query command, can be determined according to the specific command form of the target query command, or can be determined according to the configuration information corresponding to the target query command. The manner of determining the type of command is not specifically limited here.
Further, the configuration information includes, but is not limited to, a cache option, an event identifier, a cache validity period, and an associated event type, etc. The cache option comprises a short option which does not need to be cached and a long option which does not need to be cached, when the configuration information is the short option which does not need to be cached, the command type is represented as a cacheable type, and when the configuration information is the long option which does not need to be cached, the command type is represented as a non-cacheable type.
Illustratively, the command type is determined based on the configuration information in a manner determined as an example. When the target query command is test, the corresponding configuration information is short option dont _cache_short=1, long option dont _cache_long=0, cache valid period cache_time=1 min, event identifier id_ getter =1 and event type is disk, and the command type corresponding to the target query command is a cacheable type.
And step 340, if the command type is a cacheable type, executing the target query command, and determining a target cache file corresponding to the target execution command from the cached files.
In the embodiment of the application, when the command type is a cacheable type, the historical execution result corresponding to the target execution command is cached in the target cache file, and at this time, after the target query command is executed, the target cache file corresponding to the target execution command is directly determined from the cached file, and the execution result corresponding to the target execution command is not required to be acquired by executing the target execution command.
In some embodiments, when the command type is a non-cacheable type, the historical execution result corresponding to the target execution command cannot be cached, and at this time, the target execution command is executed to obtain the execution result corresponding to the target execution command, which is the execution result after the target execution command is executed this time.
Step 350, obtaining a history execution result corresponding to the target execution command from the target cache file, and taking the history execution result as an execution result of executing the target execution command at this time.
The detailed description of step S350 refers to step S120 in the foregoing embodiment, and is not repeated here.
According to the scheme provided by the embodiment, whether the historical execution result of the execution command is stored or not is determined according to the command type of the execution command, so that whether the execution command needs to be executed or not is determined, a service person is not required to manually screen the command or service, and the efficiency of acquiring the execution result is improved.
Referring to fig. 7, fig. 7 is a flowchart illustrating a method for obtaining a command execution result according to still another embodiment of the present application.
Step S410, according to the target execution command, obtaining a target cache path corresponding to the target execution command.
The cache path refers to a path for caching data or files, and in the embodiment of the present application, the target cache path refers to a path for caching a target cache file corresponding to a target execution command.
In the embodiment of the present application, the method for acquiring the target cache path according to the target execution command may be different in the creation and the acquisition methods of the cache paths of the data and the file in different operating systems or application software, and the creation and the acquisition methods of the target cache path are not specifically limited.
In some embodiments, obtaining the target cache path corresponding to the target execution command according to the target execution command includes obtaining a target hash value corresponding to the target execution command according to the target execution command. And determining the target cache path according to the target hash value.
Wherein the hash, also called pre-map, can transform an arbitrary length input into a fixed length output by a hashing algorithm. In the embodiment of the application, the target execution command is hashed, so that the hashed target execution command is a hash value with a fixed length. When the same target execution command is input, the same hash value is generated, and then the target cache path of the target execution command can be determined according to the hash value.
Illustratively, the target execution command is scsi_id, and caching is enabled for the execution result of the target execution command. Then when the target execution command carried by the target service is/lib/udev/scsi_id-replace-whitespace-whitelisted/dev/sda, the hardware type associated with the command is disk according to the configuration file of the target execution command, and the hard disk identifier is sda is obtained from the command, and the hash value of the parameter "- -replace-whitespace-whitelisted/dev/sda" is calculated to be 16b2c576be38c5f0fb329bd7e3ca571d. The path of the obtained cache file is/var/lib/cache/disk/sda/scsi_id+16b2c576 be38c5f0fb329bd7e3ca571d, and the cache file exists, and the command result is 336c92bf000a17aa3 and is finally obtained through reading the cache file and output.
Step S420, obtaining the target cache file according to the target cache path.
In the embodiment of the application, the target cache file corresponding to the target execution command can be determined according to the target cache path, and then the target cache file corresponding to the target execution command is obtained.
Step S430, obtaining a history execution result corresponding to the target execution command from the target cache file, and taking the history execution result as an execution result of executing the target execution command at this time.
The detailed description of step S430 refers to step S120 in the foregoing embodiment, and is not repeated here.
According to the scheme provided by the embodiment, the target cache path is determined according to the target execution command, and then the target cache file in the target cache path is accurately acquired, so that the historical execution result corresponding to the target execution command is accurately acquired to be used as the execution result of the execution command, the execution times of the target execution command are reduced, the load of software or hardware is reduced, meanwhile, the execution command is not required to be searched, further, the workload of service personnel is not required to be increased, and the universality of the acquisition of the execution result is improved.
Referring to fig. 8, fig. 8 shows a comparison result between a storage utilization rate corresponding to the method for obtaining a command execution result and a storage utilization rate of the command execution result in the related art according to the embodiment of the present application. As can be seen from fig. 7, in the same service, the space gap required for caching the command execution result is large in the related art. However, after the method for acquiring the command execution results provided by the application is used, the space required for caching each command execution result is approximately the same. And under the same business, the requirement of the buffer memory space used by friends is larger. Therefore, as can be seen from fig. 7, the method for acquiring the command execution result provided by the application saves the cache space of the command execution result.
Referring to fig. 9, a block diagram of a command execution result acquisition device 300 according to an embodiment of the application is shown. The device 300 for obtaining the command execution result is applied to the computer device 100, and the device 300 for obtaining the command execution result comprises a target cache file determining module 310, a target cache file processing module and a target cache file processing module, wherein the target cache file determining module 310 is used for determining a target cache file corresponding to a target execution command in response to the target execution command to be executed; and the execution result obtaining module 320 is configured to obtain, from the target cache file, a historical execution result corresponding to the target execution command, as an execution result of executing the target execution command at this time.
In some embodiments of the present application, the target cache file determining module 310 includes a target execution command obtaining unit, configured to obtain, in response to an obtained target service, the target execution command carried by the target service, a target query command determining unit, configured to determine, according to the target execution command, a target query command corresponding to the target execution command, and a target cache file determining unit, configured to execute the target query command, and determine, from cached files, a target cache file corresponding to the target execution command.
In some embodiments of the present application, the target query command determination unit includes a target query command creation subunit configured to replace an original name of the target execution command with a target name, and create a target query command corresponding to the target execution command, where the name of the target query command is the original name.
In some embodiments of the present application, the target cache file determining module 310 further includes a command type obtaining unit, configured to obtain a command type corresponding to the target query command, and the target cache file determining unit further includes a target cache file determining subunit, configured to execute the target query command if the command type is a cacheable type, and determine a target cache file corresponding to the target execution command from the cached files.
In some embodiments of the present application, the target cache file determining module 310 includes a target cache path obtaining unit, configured to obtain, according to the target execution command, a target cache path corresponding to the target execution command, and a target cache file obtaining unit, configured to obtain, according to the target cache path, the target cache file.
In some embodiments of the present application, the target cache path obtaining unit includes a target hash value obtaining subunit, configured to obtain, according to the target execution command, a target hash value corresponding to the target execution command, and a target cache path determining subunit, configured to determine the target cache path according to the target hash value.
In some embodiments of the present application, the device 300 for obtaining a command execution result further includes an image evaluation command execution result obtaining module, configured to update a historical execution result in the target cache file in response to a monitored change of a target event corresponding to the target execution command.
It will be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the apparatus and modules described above may refer to the corresponding process in the foregoing method embodiment, which is not repeated herein.
In several embodiments provided by the present application, the coupling of the modules to each other may be electrical, mechanical, or other.
In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module. The integrated modules may be implemented in hardware or in software functional modules.
The embodiment of the application provides a structural block diagram of computer equipment. Referring to fig. 10, a block diagram of a computer device according to an embodiment of the application is shown. The computer device 100 may be a computer device, such as a computer, a server, or the like, capable of running an application program. Computer device 100 in the present application may include one or more processors 101, memory 102, and one or more application programs, where the one or more application programs may be stored in memory 102 and configured to be executed by the one or more processors 101, the one or more program(s) configured to perform the methods as described in the foregoing method embodiments.
Processor 101 may include one or more processing cores. The processor 101 utilizes various interfaces and lines to connect various portions of the overall computer device 100, perform various functions of the computer device 100 and process data by executing or executing commands, programs, code sets, or command sets stored in the memory 102, and invoking data stored in the memory 102. Alternatively, the processor 101 may be implemented in at least one hardware form of digital signal Processing (DIGITAL SIGNAL Processing, DSP), field-Programmable gate array (Field-Programmable GATE ARRAY, FPGA), programmable Logic Array (PLA). The processor 101 may integrate one or a combination of several of a central processing unit (CentralProcessing Unit, CPU), an image processor (Graphics Processing Unit, GPU), and a modem, etc. The CPU mainly processes an operating system, a user interface, an application program and the like, the GPU is used for rendering and drawing display contents, and the modem is used for processing wireless communication. It will be appreciated that the modem may not be integrated into the processor 101 and may be implemented solely by a single communication chip.
Memory 102 may include random access Memory (Random Access Memory, RAM) or Read-Only Memory (ROM). Memory 102 may be used to store commands, programs, code sets, or command sets. The memory 102 may include a stored program area and a stored data area, wherein the stored program area may store commands for implementing an operating system, commands for implementing at least one function (such as a touch function, a sound playing function, an image playing function, etc.), commands for implementing the various method embodiments described below, etc. The storage data area may also store data created by the computer device 100 in use (e.g., phonebook, audiovisual data, chat log data), and the like.
Referring to fig. 11, a block diagram of a computer readable storage medium according to an embodiment of the present application is shown. The computer readable storage medium 200 has stored therein program code that can be invoked by a processor to perform the methods described in the method embodiments described above.
The computer readable storage medium 200 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk, or a ROM. Optionally, computer readable storage medium 200 comprises a non-volatile computer readable medium (non-transitory computer-readable storage medium). The computer readable storage medium 200 has storage space for program code 210 that performs any of the method steps described above. The program code can be read from or written to one or more computer program products. Program code 210 may be compressed, for example, in a suitable form.
It should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present application and not for limiting the same, and although the present application has been described in detail with reference to the above-mentioned embodiments, it will be understood by those skilled in the art that the technical solution described in the above-mentioned embodiments may be modified or some technical features may be equivalently replaced, and these modifications or replacements do not drive the essence of the corresponding technical solution to deviate from the spirit and scope of the technical solution of the embodiments of the present application.

Claims (10)

1.一种命令执行结果的获取方法,其特征在于,所述方法包括:1. A method for obtaining command execution results, characterized in that the method comprises: 响应于待执行的目标执行命令,确定所述目标执行命令对应的目标缓存文件;In response to a target execution command to be executed, determining a target cache file corresponding to the target execution command; 从所述目标缓存文件中获取所述目标执行命令对应的历史执行结果,作为本次执行所述目标执行命令的执行结果。The historical execution result corresponding to the target execution command is obtained from the target cache file as the execution result of the current execution of the target execution command. 2.根据权利要求1所述的方法,其特征在于,所述响应于待执行的目标执行命令,确定所述目标执行命令对应的目标缓存文件,包括:2. The method according to claim 1, characterized in that, in response to the target execution command to be executed, determining the target cache file corresponding to the target execution command comprises: 响应于获取到的目标业务,获取所述目标业务携带的所述目标执行命令;In response to the acquired target service, acquiring the target execution command carried by the target service; 根据所述目标执行命令,确定所述目标执行命令对应的目标查询命令;Determine, according to the target execution command, a target query command corresponding to the target execution command; 执行所述目标查询命令,从缓存的文件中确定所述目标执行命令对应的目标缓存文件。The target query command is executed to determine the target cache file corresponding to the target execution command from the cached files. 3.根据权利要求2所述的方法,其特征在于,所述根据所述目标执行命令,确定所述目标执行命令对应的目标查询命令,包括:3. The method according to claim 2, characterized in that the step of determining the target query command corresponding to the target execution command according to the target execution command comprises: 将所述目标执行命令的原始名称替换为目标名称,并建立与所述目标执行命令对应的目标查询命令,所述目标查询命令的名称为所述原始名称。The original name of the target execution command is replaced with the target name, and a target query command corresponding to the target execution command is established, wherein the name of the target query command is the original name. 4.根据权利要求2所述的方法,其特征在于,在所述执行所述目标查询命令,从缓存的文件中确定所述目标执行命令对应的目标缓存文件之前,所述方法还包括:4. The method according to claim 2, characterized in that before executing the target query command and determining the target cache file corresponding to the target execution command from the cached files, the method further comprises: 获取所述目标查询命令对应的命令类型;Obtaining the command type corresponding to the target query command; 所述执行所述目标查询命令,从缓存的文件中确定所述目标执行命令对应的目标缓存文件,包括:The executing the target query command and determining the target cache file corresponding to the target execution command from the cached files includes: 若所述命令类型为可缓存类型,则执行所述目标查询命令,从缓存的文件中确定所述目标执行命令对应的目标缓存文件。If the command type is a cacheable type, the target query command is executed to determine the target cache file corresponding to the target execution command from the cached files. 5.根据权利要求1所述的方法,其特征在于,所述响应于待执行的目标执行命令,确定所述目标执行命令对应的目标缓存文件,包括:5. The method according to claim 1, characterized in that, in response to the target execution command to be executed, determining the target cache file corresponding to the target execution command comprises: 根据所述目标执行命令,获取所述目标执行命令对应的目标缓存路径;According to the target execution command, obtaining a target cache path corresponding to the target execution command; 根据所述目标缓存路径,获取所述目标缓存文件。According to the target cache path, the target cache file is obtained. 6.根据权利要求5所述的方法,其特征在于,所述根据所述目标执行命令,获取所述目标执行命令对应的目标缓存路径,包括:6. The method according to claim 5, characterized in that the step of obtaining the target cache path corresponding to the target execution command according to the target execution command comprises: 根据所述目标执行命令,获取所述目标执行命令对应的目标哈希值;According to the target execution command, obtaining a target hash value corresponding to the target execution command; 根据所述目标哈希值,确定所述目标缓存路径。The target cache path is determined according to the target hash value. 7.根据权利要求1-6任一项所述的方法,其特征在于,所述方法还包括:7. The method according to any one of claims 1 to 6, characterized in that the method further comprises: 响应于监听到的所述目标执行命令对应的目标事件的变化,对所述目标缓存文件中的历史执行结果进行更新。In response to the monitored change of the target event corresponding to the target execution command, the historical execution result in the target cache file is updated. 8.一种命令执行结果的获取装置,其特征在于,所述装置包括:8. A device for obtaining command execution results, characterized in that the device comprises: 目标缓存文件确定模块,用于响应于待执行的目标执行命令,确定所述目标执行命令对应的目标缓存文件;A target cache file determination module, configured to determine, in response to a target execution command to be executed, a target cache file corresponding to the target execution command; 执行结果获取模块,用于从所述目标缓存文件中获取所述目标执行命令对应的历史执行结果,作为本次执行所述目标执行命令的执行结果。The execution result acquisition module is used to acquire the historical execution result corresponding to the target execution command from the target cache file as the execution result of the current execution of the target execution command. 9.一种计算机设备,其特征在于,所述计算机设备包括:9. A computer device, characterized in that the computer device comprises: 一个或多个处理器;one or more processors; 存储器;Memory; 一个或多个应用程序,其中所述一个或多个应用程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于执行如权利要求1至7任一项所述的方法。One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the method according to any one of claims 1 to 7. 10.一种计算机可读取存储介质,其特征在于,所述计算机可读取存储介质中存储有程序代码,所述程序代码可被处理器调用执行如权利要求1-7任一项所述的方法。10. A computer-readable storage medium, characterized in that program codes are stored in the computer-readable storage medium, and the program codes can be called by a processor to execute the method according to any one of claims 1 to 7.
CN202411419846.9A 2024-10-11 2024-10-11 Command execution result acquisition method and device, computer equipment and storage medium Pending CN119597350A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202411419846.9A CN119597350A (en) 2024-10-11 2024-10-11 Command execution result acquisition method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202411419846.9A CN119597350A (en) 2024-10-11 2024-10-11 Command execution result acquisition method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN119597350A true CN119597350A (en) 2025-03-11

Family

ID=94835085

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202411419846.9A Pending CN119597350A (en) 2024-10-11 2024-10-11 Command execution result acquisition method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN119597350A (en)

Similar Documents

Publication Publication Date Title
CN109657174B (en) Method and apparatus for updating data
CN111078147A (en) Processing method, device and equipment for cache data and storage medium
CN108090078B (en) Document online preview method and device, storage medium and electronic equipment
CN110737682A (en) cache operation method, device, storage medium and electronic equipment
CN113961510B (en) File processing method, device, equipment and storage medium
US9369332B1 (en) In-memory distributed cache
CN113805864A (en) Project engineering generation method and device, electronic equipment and storage medium
CN111488492A (en) Method and apparatus for retrieving graph database
CN111752960B (en) Data processing method and device
CN118250206A (en) High concurrency pressure testing method and related device based on flow playback
CN115858104B (en) Transaction commit sequence number snapshot acquisition method, device, equipment and storage medium
CN111737661A (en) Exception stack processing method, system, electronic device and storage medium
CN117785501A (en) Data caching method, device, storage medium and electronic equipment
CN112306413B (en) Method, device, equipment and storage medium for accessing memory
CN113051244B (en) Data access method and device, data acquisition method and device
CN110377328A (en) A kind of data capture method, device, equipment and storage medium
US10616291B2 (en) Response caching
CN119597350A (en) Command execution result acquisition method and device, computer equipment and storage medium
US10067678B1 (en) Probabilistic eviction of partial aggregation results from constrained results storage
CN112559568B (en) Method, device and computer-readable storage medium for determining virtual items
CN115167847A (en) Application log acquisition method, device, equipment and storage medium
CN113110846A (en) Method and device for acquiring environment variable
US12235759B2 (en) Pointer-based sharing of a data structure between threads
CN114265850B (en) A method, apparatus, device, and storage medium for updating a local cache.
CN117235078B (en) Method, system, device and storage medium for processing mass data at high speed

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination