CN111324586A - Image display method and device based on cache, electronic equipment and medium - Google Patents

Image display method and device based on cache, electronic equipment and medium Download PDF

Info

Publication number
CN111324586A
CN111324586A CN201811536775.5A CN201811536775A CN111324586A CN 111324586 A CN111324586 A CN 111324586A CN 201811536775 A CN201811536775 A CN 201811536775A CN 111324586 A CN111324586 A CN 111324586A
Authority
CN
China
Prior art keywords
picture
data stream
cache
key
server
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.)
Granted
Application number
CN201811536775.5A
Other languages
Chinese (zh)
Other versions
CN111324586B (en
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.)
China Mobile Communications Group Co Ltd
China Mobile Hangzhou Information Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Hangzhou Information Technology 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 China Mobile Communications Group Co Ltd, China Mobile Hangzhou Information Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN201811536775.5A priority Critical patent/CN111324586B/en
Publication of CN111324586A publication Critical patent/CN111324586A/en
Application granted granted Critical
Publication of CN111324586B publication Critical patent/CN111324586B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a picture display method, a picture display device, electronic equipment and a medium based on cache, wherein the method comprises the following steps: the method comprises the steps that the electronic equipment obtains feature information of a picture data stream header of a picture from a server according to a network address of the picture to be displayed, wherein the feature information of the picture data stream header is generated according to a timestamp of a picture uploading server; generating a key according to a character string formed by splicing the timestamp corresponding to the characteristic information and the network address and a preset Hash algorithm; and if the target picture corresponding to the key is not stored in the cache, obtaining the picture data stream of the picture from the server, converting the picture data stream into the picture, storing the picture in the cache according to the key, and displaying the picture. The cache-based picture display scheme avoids network traffic waste and ensures picture display accuracy.

Description

Image display method and device based on cache, electronic equipment and medium
Technical Field
The present invention relates to the field of image caching technologies, and in particular, to a method and an apparatus for displaying an image based on caching, an electronic device, and a medium.
Background
When an Application (APP) runs in an electronic device, in order to improve a User Interface (UI) response speed, user experience, and reduce network traffic, a picture caching technology is generally used to cache pictures. Specifically, when the electronic device loads the picture for the first time, the picture is not cached in the electronic device, the electronic device needs to load the picture from the network, and after the picture is loaded, the picture is stored in the cache, so that when the picture is used again, the picture does not need to be loaded from the network again, and the purposes of reducing network traffic, improving UI response speed and the like are achieved.
At present, pictures are usually stored in a cache in a (key, value) form, where a hash (key) is a hash value obtained by performing a hash operation on a name, a network address, and other identifiers of the picture, and a value (value) is real data of the picture. However, in the actual use process, the network address of the picture is not changed, but the content of the picture is changed, in this case, the key generated according to the identifier of the picture is not changed, the picture corresponding to the key having the mapping relationship with the network address in the cache is displayed, and the situation that the picture is always an old picture occurs, which affects the user experience.
In the prior art, a mode of setting a cache expiration time to automatically update a cache is usually adopted to prevent a situation that cached pictures are always old pictures, but the cache expiration time cannot be accurately set in the mode, and when the pictures are automatically updated, pictures which are not changed are also updated again, so that huge traffic waste is caused, and the significance of the cache is reduced, so that the problems of network traffic resource waste and inaccurate picture display of old pictures in the prior art need to be solved.
Disclosure of Invention
The invention provides a picture display method, a picture display device, electronic equipment and a picture display medium based on cache, which are used for solving the problems of network traffic waste and inaccurate picture display in the prior art.
In a first aspect, the present invention discloses a method for displaying pictures based on a cache, wherein the method comprises:
acquiring characteristic information of a picture data stream header of a picture from a server according to a network address of the picture to be displayed, wherein the characteristic information of the picture data stream header is generated according to a timestamp of a picture uploading server;
generating a hash value key according to a character string formed by splicing the timestamp corresponding to the characteristic information and the network address and a preset hash algorithm;
and if the target picture corresponding to the key is not stored in the cache, obtaining the picture data stream of the picture from the server, converting the picture data stream into the picture, storing the picture in the cache according to the key, and displaying the picture.
In an optional design, the generating of the feature information of the picture data stream header according to the timestamp of the picture uploading server includes:
converting the picture into a picture data stream, converting the current timestamp into feature information of a set byte, adding the feature information into the head of the picture data stream, and uploading the picture data stream added with the feature information to the server.
In an alternative design, the method further includes:
and if the target picture corresponding to the key is stored in the cache, acquiring and displaying the target picture stored in the cache.
In an optional design, before storing the picture in a cache according to the key, the method further includes:
and establishing a mapping relation between the network address and the key.
In an optional design, before the obtaining, from the server, the feature information of the header of the picture data stream of the picture according to the network address of the picture to be displayed, the method further includes:
judging whether the network can be connected or not;
if so, acquiring the characteristic information of the picture data stream header of the picture from a server according to the network address of the picture to be displayed;
if not, judging whether a target key with a mapping relation with the network address exists in the cache or not, if so, acquiring and displaying a picture corresponding to the target key in the cache, and if not, displaying prompt information of an error picture.
In an optional design, before generating a key according to a character string formed by splicing the timestamp corresponding to the feature information and the network address and a preset hash algorithm, the method further includes:
and checking the integrity of the characteristic information, and if the integrity passes the checking, generating a key according to a character string formed by splicing the timestamp corresponding to the characteristic information and the network address and a preset Hash algorithm.
In a second aspect, the present invention discloses a picture display device based on cache, the device comprising:
the acquisition module is used for acquiring the characteristic information of the picture data stream header of the picture from a server according to the network address of the picture to be displayed, wherein the characteristic information of the picture data stream header is generated according to the time stamp of the picture uploading server;
the generating module is used for generating a hash value key according to a character string formed by splicing the timestamp corresponding to the characteristic information and the network address and a preset hash algorithm;
and the cache display module is used for acquiring the picture data stream of the picture from the server, converting the picture data stream into the picture, storing the picture in a cache according to the key and displaying the picture if the target picture corresponding to the key is not stored in the cache.
In an optional design, the generating of the feature information of the picture data stream header according to the timestamp of the picture uploading server includes:
converting the picture into a picture data stream, converting the current timestamp into feature information of a set byte, adding the feature information into the head of the picture data stream, and uploading the picture data stream added with the feature information to the server.
In an optional design, the cache display module is further configured to, if the target picture corresponding to the key is stored in the cache, obtain and display the target picture stored in the cache.
In an optional design, the cache display module is further configured to establish a mapping relationship between the network address and the key.
In an alternative design, the apparatus further comprises:
the judging module is used for judging whether the network can be connected or not; if yes, triggering an acquisition module, if not, judging whether a target key with a mapping relation with the network address exists in the cache, if so, acquiring and displaying a picture corresponding to the target key in the cache, and if not, displaying prompt information of an error picture.
In an alternative design, the apparatus further comprises:
and the verification module is used for verifying the integrity of the characteristic information, and if the verification is passed, the generation module is triggered.
In a third aspect, the present invention discloses an electronic device, comprising: a memory, a processor, and a transceiver;
the processor is used for reading the program in the memory and executing the following processes: acquiring characteristic information of a picture data stream header of a picture from a server through a transceiver according to a network address of the picture to be displayed, wherein the characteristic information of the picture data stream header is generated according to a timestamp of a picture uploading server; generating a hash value key according to a character string formed by splicing the timestamp corresponding to the characteristic information and the network address and a preset hash algorithm; and if the target picture corresponding to the key is not stored in the cache, obtaining the picture data stream of the picture from the server, converting the picture data stream into the picture, storing the picture in the cache according to the key, and displaying the picture.
In an optional design, the generating of the feature information of the picture data stream header according to the timestamp of the picture uploading server includes:
converting the picture into a picture data stream, converting the current timestamp into feature information of a set byte, adding the feature information into the head of the picture data stream, and uploading the picture data stream added with the feature information to the server.
In an optional design, the processor is further configured to, if a target picture corresponding to the key is stored in the cache, obtain the target picture stored in the cache and display the target picture.
In an optional design, the processor is further configured to establish a mapping relationship between the network address and the key.
In an alternative design, the processor is further configured to determine whether a network connection is possible; if the image data stream header of the image is not the same as the image data stream header of the image to be displayed, judging whether a target key with a mapping relation with the network address exists in the cache or not through the transceiver, if the judgment result is yes, acquiring and displaying the image corresponding to the target key in the cache, and if the judgment result is not the same as the image data stream header of the image to be displayed, displaying prompt information of an error image.
In an optional design, the processor is further configured to verify integrity of the characteristic information, and perform a subsequent step if the verification is passed.
In a fourth aspect, the present invention discloses an electronic device, comprising: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;
the memory has stored therein a computer program which, when executed by the processor, causes the processor to perform the method as set forth in the first aspect or any one of the alternative designs of the first aspect.
In a fifth aspect, the present invention discloses a computer readable storage medium storing a computer program executable by an electronic device, the program, when run on the electronic device, causing the electronic device to perform the method as set forth in the first aspect or any one of the alternative designs of the first aspect.
In a sixth aspect, the present invention discloses a computer program product, which, when read and executed by an electronic device, causes the electronic device to perform the method of the first aspect or any of the alternative designs of the first aspect.
The invention has the following beneficial effects:
in the embodiment of the invention, the characteristic information generated according to the uploading timestamp is added to the head of the picture data stream, and whether the picture exists in the cache is judged according to the characteristic information and the hash value generated by the network address of the picture during picture display, so that whether the cache needs to be updated is judged, the problem that the picture is displayed as an old picture due to the fact that the picture content cannot be identified to change when the picture content is changed when the network address of the picture is unchanged in the prior art is solved, and the picture display accuracy is improved. Meanwhile, whether the content of the picture changes can be determined only by acquiring the characteristic information of the header of the picture data stream, so that the picture in the cache is prevented from being updated when the picture does not change, and the network flow is saved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic diagram of a process of displaying a picture based on a cache according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a picture uploading process according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a feature information data protocol according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a cache-based image display device according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the present invention will be described in further detail with reference to the accompanying drawings, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example 1:
fig. 1 is a schematic diagram of a process of displaying a picture based on a cache according to an embodiment of the present invention, where the process includes:
s101: and acquiring the characteristic information of the picture data stream head of the picture from a server according to the network address of the picture to be displayed.
The image display method based on the cache is applied to electronic equipment, and the electronic equipment can be mobile phones, tablet computers, notebook computers, personal computers and other equipment.
Specifically, in the embodiment of the present invention, the header of the picture data stream of the picture stored in the server includes the feature information of the picture, where the feature information of the picture is generated according to the timestamp of the picture uploading server.
Generating the feature information of the picture data stream header according to the timestamp of the picture uploading server comprises:
converting the picture into a picture data stream, converting the current timestamp into feature information of a set byte, adding the feature information into the head of the picture data stream, and uploading the picture data stream added with the feature information to the server.
Specifically, the picture uploading device converts the picture into a picture data stream, acquires the current timestamp, generates feature information of a set byte containing the current timestamp, adds the generated feature information to the header of the picture data stream, generates the picture data stream containing the feature information, and uploads the picture data stream containing the feature information to the server.
Exemplarily, referring to the picture uploading process shown in fig. 2: (1) the picture uploading equipment converts the pictures to be uploaded into a picture data stream (Br); (2) the picture uploading equipment acquires a current timestamp (ts), and constructs set byte characteristic information (Bh) containing the current timestamp (ts) according to a set characteristic information data protocol, in the embodiment of the invention, the set byte is 32 bytes, the set characteristic information (Bh) data protocol is as shown in fig. 3, and the characteristic information sequentially consists of a timestamp length of 4 bytes (bits), a timestamp of t bytes and a bit complement part of 32-4-t bytes; (3) the picture uploading device adds the generated characteristic information (Bh) to the head of the picture data stream (Br) to output a new picture data stream (Bp), wherein Bp is Bh + Br; (4) the picture uploading device encodes the picture data stream (Bp) according to the encoding mode of the device, such as Base64 encoding and the like, obtains an encoded picture data stream (Bb), and uploads the picture data stream (Bb) containing the characteristic information to the server.
Specifically, when the content of the picture uploaded to the server is updated, as shown in fig. 3, after the picture uploading device converts a new picture into a picture data stream, the feature information is regenerated according to the current timestamp, the regenerated feature information is added to the picture data stream converted from the new picture, the picture data stream including the regenerated feature information is uploaded to the server, the picture to be updated is updated under the network address of the picture to be updated, and the feature information in the updated picture is changed.
Preferably, in the embodiment of the present invention, the network address of the picture is a Uniform Resource Locator (URL), and the picture uploading device may be a mobile phone, a tablet computer, a notebook computer, or the like, and may be the same device as the electronic device or different from the electronic device, which is not described again.
Specifically, the electronic device obtains feature information of a picture data stream header stored by the server under a network address according to the network address of the picture to be displayed. As shown in fig. 3, taking the feature information as 32 bytes as an example, the electronic device only obtains the feature information of 32 bytes of the header of the picture data stream stored by the server under the network address, so as to avoid obtaining the whole picture data stream, and the data amount relative to 1M, 3M, etc. of the picture can be ignored.
S102: and generating a key according to a character string formed by splicing the timestamp corresponding to the characteristic information and the network address and a preset Hash algorithm.
Specifically, the electronic device obtains a timestamp corresponding to the feature information according to the feature information of the header of the picture data stream. Taking the feature information shown in fig. 3 as an example, the process of acquiring the timestamp corresponding to the feature information is as follows: the electronic device first obtains the content of the first 4 bytes of the feature information, parses the content of the first 4 bytes, and obtains the length (size) of the time stamp of the integer type, i.e., the time stamp length t shown in fig. 3, for example, by performing Base64 decoding. And acquiring the content of the 5 th byte to the 4+ size byte from the characteristic information, and analyzing the content of the 5 th byte to the 4+ size byte to acquire the long integer time stamp (ts).
The electronic device splices the acquired timestamp (ts) and the network address of the picture to be displayed into a character string, and runs a set hash Algorithm, such as a Message Digest Algorithm (MD 5), to generate a key of the spliced character string.
Optionally, before generating a key according to a character string formed by splicing the timestamp corresponding to the feature information and the network address and a preset hash algorithm, the method further includes:
and checking the integrity of the characteristic information, and if the integrity passes the checking, generating a key according to a character string formed by splicing the timestamp corresponding to the characteristic information and the network address and a preset Hash algorithm.
Preferably, in the embodiment of the present invention, after the electronic device obtains the feature information of the header of the picture data stream, the integrity of the feature information is checked, for example, whether the feature information is a set byte is checked, and after the check is passed, the subsequent step of generating a key is performed, so as to ensure the accuracy of the picture caching and displaying.
S103: and judging whether the target picture corresponding to the key is stored in the cache, if so, performing S104, and if not, performing S105.
S104: and acquiring and displaying the target picture stored in the cache.
S105: and obtaining the picture data stream of the picture from the server, converting the picture data stream into the picture, storing the picture in a cache according to the key, and displaying the picture.
In the embodiment of the present invention, the cache of the electronic device may be a network cache, a memory cache, a disk cache, or the like of the electronic device. The cached pictures of the electronic device are saved in the cache of the electronic device in a (key, value) form. After keys of the spliced character strings are generated, the electronic equipment searches whether a target key identical to the generated key exists in a cache of the electronic equipment, then judges whether a target picture corresponding to the generated key exists in the cache, determines that the target picture corresponding to the generated key exists in the cache if the target key identical to the generated key exists in the cache, and acquires and displays the target picture corresponding to the target key in the cache.
If the target picture corresponding to the generated key does not exist in the cache, the electronic equipment acquires the complete picture data stream of the picture from the server according to the network address of the picture to be displayed, removes the characteristic information of the head part of the picture data stream, obtains the picture data stream of the real picture content, and converts the picture data stream into the picture. Meanwhile, the electronic device saves the picture in the cache by taking the generated key as a key value, namely, the picture is saved in the cache in a (key, value) form. Illustratively, taking the generated key as key (x) and the picture as value (y) as an example, the picture is saved in the cache of the electronic device in the form of (key (x), value (y)). And after the electronic equipment stores the picture in the cache, displaying the picture.
In the embodiment of the invention, the characteristic information generated according to the uploading timestamp is added to the head of the picture data stream, and whether the picture exists in the cache is judged according to the characteristic information and the hash value generated by the network address of the picture during picture display, so that whether the cache needs to be updated is judged, the problem that the picture is displayed as an old picture due to the fact that the picture content cannot be identified to change when the picture content is changed when the network address of the picture is unchanged in the prior art is solved, and the picture display accuracy is improved. Meanwhile, whether the content of the picture changes can be determined only by acquiring the characteristic information of the header of the picture data stream, so that the picture in the cache is prevented from being updated when the picture does not change, and the network flow is saved.
Example 2:
in order to improve the user experience, on the basis of the above embodiment, in an embodiment of the present invention, before saving the picture in the cache according to the key, the method further includes:
and establishing a mapping relation between the network address and the key.
Specifically, in the embodiment of the present invention, a mapping relationship between a network address corresponding to the picture and a key corresponding to the picture is further established, so that the picture is displayed when the electronic device cannot connect to a network.
Optionally, before the obtaining, according to the network address of the picture to be displayed, the feature information of the picture data stream header of the picture from the server, the method further includes:
judging whether the network can be connected or not;
if so, acquiring the characteristic information of the picture data stream header of the picture from a server according to the network address of the picture to be displayed;
if not, judging whether a target key with a mapping relation with the network address exists in the cache or not, if so, acquiring and displaying a picture corresponding to the target key in the cache, and if not, displaying prompt information of an error picture.
Specifically, before obtaining the feature information of the picture data stream header from the server, the electronic device judges whether the electronic device can be connected to the network, and if the electronic device can be connected to the network, the electronic device performs the subsequent step of obtaining the feature information of the picture data stream header of the picture from the server according to the network address of the picture to be displayed; if the network cannot be connected, according to the network address of the picture to be displayed, whether a target key with a mapping relation with the network address of the picture to be displayed exists or not is searched in the mapping relation between the network address and the key, if yes, the picture corresponding to the target key in the cache is obtained and displayed, and if not, prompt information of an error picture is displayed, such as displaying a default error picture.
Example 3:
fig. 4 is a schematic structural diagram of a picture display device based on a cache according to an embodiment of the present invention, where the device includes:
an obtaining module 41, configured to obtain, from a server, feature information of a picture data stream header of a picture according to a network address of the picture to be displayed, where the feature information of the picture data stream header is generated according to a timestamp of the picture uploading server;
the generating module 42 is configured to generate a hash value key according to a character string formed by splicing the timestamp corresponding to the feature information and the network address and a preset hash algorithm;
and a cache display module 43, configured to, if the target picture corresponding to the key is not stored in the cache, obtain a picture data stream of the picture from the server, convert the picture data stream into a picture, store the picture in the cache according to the key, and display the picture.
Preferably, the generating of the feature information of the picture data stream header according to the timestamp of the picture upload server includes:
converting the picture into a picture data stream, converting the current timestamp into feature information of a set byte, adding the feature information into the head of the picture data stream, and uploading the picture data stream added with the feature information to the server.
Preferably, the cache display module 43 is further configured to, if the target picture corresponding to the key is stored in the cache, obtain the target picture stored in the cache and display the target picture.
Preferably, the cache display module 43 is further configured to establish a mapping relationship between the network address and the key.
Preferably, the apparatus further comprises:
a judging module 44, configured to judge whether a network can be connected; if yes, triggering an acquisition module, if not, judging whether a target key with a mapping relation with the network address exists in the cache, if so, acquiring and displaying a picture corresponding to the target key in the cache, and if not, displaying prompt information of an error picture.
Preferably, the apparatus further comprises:
and the checking module 45 is used for checking the integrity of the characteristic information, and if the checking is passed, the generating module is triggered.
Example 4:
based on the same inventive concept, the embodiment of the present invention further provides an electronic device, and because the principle of the electronic device for solving the problem is similar to the cache-based picture display method, the implementation of the electronic device may refer to the implementation of the method, and repeated details are omitted.
Fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, where in fig. 5, the bus architecture may include any number of interconnected buses and bridges, and specifically, one or more processors 51 represented by a processor 51 and various circuits of a memory 53 represented by a memory 53 are linked together. The bus architecture may also link together various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. The bus interface provides an interface. The transceiver 52 may be a number of elements, including a transmitter and a transceiver, providing a means for communicating with various other apparatus over a transmission medium. The processor 51 is responsible for managing the bus architecture and general processing, and the memory 53 may store data used by the processor 51 in performing operations.
In the electronic device provided in the embodiment of the present invention:
the processor 51 is configured to read the program in the memory 53, and execute the following processes: acquiring the feature information of the picture data stream header of the picture from a server through a transceiver 52 according to the network address of the picture to be displayed, wherein the feature information of the picture data stream header is generated according to the timestamp of the picture uploading server; generating a hash value key according to a character string formed by splicing the timestamp corresponding to the characteristic information and the network address and a preset hash algorithm; and if the target picture corresponding to the key is not stored in the cache, obtaining the picture data stream of the picture from the server, converting the picture data stream into the picture, storing the picture in the cache according to the key, and displaying the picture.
Preferably, the generating of the feature information of the picture data stream header according to the timestamp of the picture upload server includes:
converting the picture into a picture data stream, converting the current timestamp into feature information of a set byte, adding the feature information into the head of the picture data stream, and uploading the picture data stream added with the feature information to the server.
Preferably, the processor 51 is further configured to, if the target picture corresponding to the key is stored in the cache, obtain the target picture stored in the cache and display the target picture.
Preferably, the processor 51 is further configured to establish a mapping relationship between the network address and the key.
Preferably, the processor 51 is further configured to determine whether a network can be connected; if yes, the step of obtaining the characteristic information of the picture data stream head of the picture from the server through the transceiver 52 according to the network address of the picture to be displayed is carried out, if not, whether a target key with a mapping relation with the network address exists in the cache is judged, if yes, the picture corresponding to the target key in the cache is obtained and displayed, and if not, prompt information of an error picture is displayed.
Preferably, the processor 51 is further configured to verify the integrity of the characteristic information, and perform the subsequent steps if the verification is passed.
Example 5:
on the basis of the foregoing embodiments, an embodiment of the present invention further provides an electronic device, as shown in fig. 6, including: the system comprises a processor 61, a communication interface 62, a memory 63 and a communication bus 64, wherein the processor 61, the communication interface 62 and the memory 63 complete mutual communication through the communication bus 64;
the memory 63 stores therein a computer program that, when executed by the processor 61, causes the processor 61 to execute the cache-based picture display method described in the above embodiments.
On the basis of the foregoing embodiments, an embodiment of the present invention further provides a computer storage readable storage medium, where a computer program executable by an electronic device is stored in the computer storage readable storage medium, and when the computer program runs on the electronic device, the electronic device is caused to execute the cache-based image display method described in the foregoing embodiments.
For the system/apparatus embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference may be made to some descriptions of the method embodiments for relevant points.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While the preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all alterations and modifications as fall within the scope of the application.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (10)

1. A picture display method based on cache is characterized by comprising the following steps:
acquiring characteristic information of a picture data stream header of a picture from a server according to a network address of the picture to be displayed, wherein the characteristic information of the picture data stream header is generated according to a timestamp of a picture uploading server;
generating a hash value key according to a character string formed by splicing the timestamp corresponding to the characteristic information and the network address and a preset hash algorithm;
and if the target picture corresponding to the key is not stored in the cache, obtaining the picture data stream of the picture from the server, converting the picture data stream into the picture, storing the picture in the cache according to the key, and displaying the picture.
2. The method of claim 1, wherein generating the feature information of the picture data stream header according to the timestamp of the picture upload server comprises:
converting the picture into a picture data stream, converting the current timestamp into feature information of a set byte, adding the feature information into the head of the picture data stream, and uploading the picture data stream added with the feature information to the server.
3. The method of claim 1, wherein the method further comprises:
and if the target picture corresponding to the key is stored in the cache, acquiring and displaying the target picture stored in the cache.
4. The method of claim 1, wherein prior to saving the picture in a cache according to the key, the method further comprises:
and establishing a mapping relation between the network address and the key.
5. The method of claim 1, wherein before the obtaining the feature information of the picture data stream header of the picture from the server according to the network address of the picture to be displayed, the method further comprises:
judging whether the network can be connected or not;
if so, acquiring the characteristic information of the picture data stream header of the picture from a server according to the network address of the picture to be displayed;
if not, judging whether a target key with a mapping relation with the network address exists in the cache or not, if so, acquiring and displaying a picture corresponding to the target key in the cache, and if not, displaying prompt information of an error picture.
6. The method according to claim 1, wherein before generating the key according to a character string formed by splicing the timestamp corresponding to the feature information and the network address and a preset hash algorithm, the method further comprises:
and checking the integrity of the characteristic information, and if the integrity passes the checking, generating a key according to a character string formed by splicing the timestamp corresponding to the characteristic information and the network address and a preset Hash algorithm.
7. A cache-based picture display apparatus, the apparatus comprising:
the acquisition module is used for acquiring the characteristic information of the picture data stream header of the picture from a server according to the network address of the picture to be displayed, wherein the characteristic information of the picture data stream header is generated according to the time stamp of the picture uploading server;
the generating module is used for generating a hash value key according to a character string formed by splicing the timestamp corresponding to the characteristic information and the network address and a preset hash algorithm;
and the cache display module is used for acquiring the picture data stream of the picture from the server, converting the picture data stream into the picture, storing the picture in a cache according to the key and displaying the picture if the target picture corresponding to the key is not stored in the cache.
8. An electronic device, comprising: a memory, a processor, and a transceiver;
the processor is used for reading the program in the memory and executing the following processes: acquiring characteristic information of a picture data stream header of a picture from a server through a transceiver according to a network address of the picture to be displayed, wherein the characteristic information of the picture data stream header is generated according to a timestamp of a picture uploading server; generating a hash value key according to a character string formed by splicing the timestamp corresponding to the characteristic information and the network address and a preset hash algorithm; and if the target picture corresponding to the key is not stored in the cache, obtaining the picture data stream of the picture from the server, converting the picture data stream into the picture, storing the picture in the cache according to the key, and displaying the picture.
9. An electronic device, comprising: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;
the memory has stored therein a computer program which, when executed by the processor, causes the processor to carry out the steps of the method of any one of claims 1-6.
10. A computer-readable storage medium, characterized in that it stores a computer program executable by an electronic device, which program, when run on the electronic device, causes the electronic device to carry out the steps of the method according to any one of claims 1-6.
CN201811536775.5A 2018-12-14 2018-12-14 Picture display method and device based on cache, electronic equipment and medium Active CN111324586B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811536775.5A CN111324586B (en) 2018-12-14 2018-12-14 Picture display method and device based on cache, electronic equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811536775.5A CN111324586B (en) 2018-12-14 2018-12-14 Picture display method and device based on cache, electronic equipment and medium

Publications (2)

Publication Number Publication Date
CN111324586A true CN111324586A (en) 2020-06-23
CN111324586B CN111324586B (en) 2024-04-09

Family

ID=71166955

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811536775.5A Active CN111324586B (en) 2018-12-14 2018-12-14 Picture display method and device based on cache, electronic equipment and medium

Country Status (1)

Country Link
CN (1) CN111324586B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112256993A (en) * 2020-09-22 2021-01-22 恒鸿达科技有限公司 Picture accelerated display method, system, equipment and medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030097564A1 (en) * 2000-08-18 2003-05-22 Tewari Anoop Kailasnath Secure content delivery system
CN101409706A (en) * 2007-10-09 2009-04-15 华为技术有限公司 Method, system and relevant equipment for distributing data of edge network
CN102096712A (en) * 2011-01-28 2011-06-15 深圳市五巨科技有限公司 Method and device for cache-control of mobile terminal
CN103503486A (en) * 2011-12-27 2014-01-08 华为技术有限公司 Video distribution method and system and video playing method and system
CN104933054A (en) * 2014-03-18 2015-09-23 上海帝联信息科技股份有限公司 Uniform resource locator (URL) storage method and device of cache resource file, and cache server
CN107766469A (en) * 2017-09-29 2018-03-06 北京金山安全管理系统技术有限公司 A kind of method for caching and processing and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030097564A1 (en) * 2000-08-18 2003-05-22 Tewari Anoop Kailasnath Secure content delivery system
CN101409706A (en) * 2007-10-09 2009-04-15 华为技术有限公司 Method, system and relevant equipment for distributing data of edge network
CN102096712A (en) * 2011-01-28 2011-06-15 深圳市五巨科技有限公司 Method and device for cache-control of mobile terminal
CN103503486A (en) * 2011-12-27 2014-01-08 华为技术有限公司 Video distribution method and system and video playing method and system
CN104933054A (en) * 2014-03-18 2015-09-23 上海帝联信息科技股份有限公司 Uniform resource locator (URL) storage method and device of cache resource file, and cache server
CN107766469A (en) * 2017-09-29 2018-03-06 北京金山安全管理系统技术有限公司 A kind of method for caching and processing and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
马郓;刘?哲;梅宏;: "面向移动Web应用的浏览器缓存性能度量与优化" *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112256993A (en) * 2020-09-22 2021-01-22 恒鸿达科技有限公司 Picture accelerated display method, system, equipment and medium
CN112256993B (en) * 2020-09-22 2023-06-27 恒鸿达科技有限公司 Picture acceleration display method, system, equipment and medium

Also Published As

Publication number Publication date
CN111324586B (en) 2024-04-09

Similar Documents

Publication Publication Date Title
CN108270874B (en) Application program updating method and device
CN104503780A (en) Method and device for providing application channel packet
CN102882974B (en) Method for saving website access resource by website identification version number
CN108733317B (en) Data storage method and device
CN112685154A (en) Data processing method of task flow engine, device and medium
EP3819802A1 (en) Data consistency checking method and data uploading/downloading apparatus
US20210099432A1 (en) Data consistency verification method, and data uploading and downloading device
CN115237853A (en) Data query method and device, electronic equipment and storage medium
CN112506878A (en) File processing method and device, storage medium and electronic equipment
CN109788251B (en) Video processing method, device and storage medium
CN114781351A (en) Bidding file analysis method, device, equipment and medium based on electric power data
CN111324586B (en) Picture display method and device based on cache, electronic equipment and medium
CN111107133A (en) Generation method of difference packet, data updating method, device and storage medium
CN112925559B (en) Resource packaging method, device, medium and electronic equipment
CN114185808A (en) Automatic testing method and device, electronic equipment and computer readable storage medium
CN111695098A (en) Multi-distributed cluster access method and device
CN112905464B (en) Application running environment data processing method and device
CN110930253A (en) Intelligent contract internal main key generation method and device, computer equipment and storage medium
CN115589316A (en) Data encryption transmission method and device, electronic equipment and storage medium
CN106156235B (en) Picture downloading method and system based on Android platform
CN110099117B (en) Method and device for issuing full amount of multi-version DNS zone files
CN110781523B (en) Method and apparatus for processing information
CN116702218B (en) Rendering method, device, terminal and storage medium of three-dimensional model in applet
CN113918237A (en) Gray scale publishing method, device, equipment and computer readable medium
KR102433764B1 (en) System and method for monitoring service

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
GR01 Patent grant
GR01 Patent grant