CN108259563B - Data caching method, device, server and storage medium - Google Patents

Data caching method, device, server and storage medium Download PDF

Info

Publication number
CN108259563B
CN108259563B CN201711319134.XA CN201711319134A CN108259563B CN 108259563 B CN108259563 B CN 108259563B CN 201711319134 A CN201711319134 A CN 201711319134A CN 108259563 B CN108259563 B CN 108259563B
Authority
CN
China
Prior art keywords
cache
picture
service
service identifier
space
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.)
Active
Application number
CN201711319134.XA
Other languages
Chinese (zh)
Other versions
CN108259563A (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.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management 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 Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN201711319134.XA priority Critical patent/CN108259563B/en
Publication of CN108259563A publication Critical patent/CN108259563A/en
Application granted granted Critical
Publication of CN108259563B publication Critical patent/CN108259563B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/58Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/182Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being a pixel
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
    • H04N19/423Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation characterised by memory arrangements

Abstract

The invention relates to a data caching method, a data caching device, a server and a storage medium, wherein the method comprises the following steps: analyzing the received service data cache request, and extracting service data and a service identifier in the service data cache request through analysis; determining the pixel size of a cache picture according to the preset image parameter digit and the character digit obtained by counting the service data; coding the service data to obtain a pixel parameter array; reading pixel parameters from the pixel parameter array in sequence according to preset image parameter digits; generating a cache picture matched with the pixel size of the cache picture according to the read pixel parameters, and adding the service identifier into the cache picture; and inquiring a cache space corresponding to the service identifier, and storing the cache picture added with the service identifier to the inquired cache space. The cached pictures are cached in the caching space by drawing the cached data into the cached pictures in a coding mode, so that the leakage of the service data is avoided, and the caching safety of the service data is improved.

Description

Data caching method, device, server and storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a data caching method, apparatus, server, and storage medium.
Background
With the development of internet technology, more and more data is transmitted or cached through the internet. With the increase of data volume in the internet, a great variety of data-based services are emerging, and the range of industries involved in the services is relatively wide. In the service processing, some service data is also transmitted or buffered through the internet.
However, during the service processing, the service data needs to be buffered. In the traditional data caching process, the service data is not encrypted, the plaintext service data is directly stored in the caching space, and the security of the service data in the caching space is low.
Disclosure of Invention
Based on this, it is necessary to provide a data caching method, apparatus, server and storage medium for the problem of low security of the business data in the cache space.
A method of data caching, the method comprising:
analyzing the received service data cache request, and extracting service data and a service identifier in the service data cache request through analysis;
determining the pixel size of a cache picture according to the preset image parameter digit and the character digit obtained by counting the service data;
coding the service data to obtain a pixel parameter array;
reading pixel parameters from the pixel parameter array in sequence according to the preset image parameter digit;
generating a cache picture matched with the pixel size of the cache picture according to the read pixel parameters, and adding the service identifier into the cache picture;
and inquiring a cache space corresponding to the service identifier, and storing the cache picture added with the service identifier to the inquired cache space.
A data caching apparatus, comprising:
the service data acquisition module is used for analyzing the received service data cache request and extracting service data and a service identifier in the service data cache request through analysis;
the picture size determining module is used for determining the pixel size of the cache picture according to the preset image parameter digit and the character digit obtained by counting the service data;
the pixel array determining module is used for coding the service data to obtain a pixel parameter array;
the pixel parameter reading module is used for reading pixel parameters from the pixel parameter array in sequence according to the preset image parameter digit;
the cache picture generation module is used for generating a cache picture matched with the pixel size of the cache picture according to the read pixel parameters and adding the service identifier into the cache picture;
and the cache picture storage module is used for inquiring the cache space corresponding to the service identifier and storing the cache picture added with the service identifier to the inquired cache space.
A server comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the data caching method provided in any embodiment of the invention when executing the computer program.
A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the data caching method provided in any one of the embodiments of the present invention.
According to the data caching method, the data caching device, the server and the storage medium, the obtained service data are coded, the pixel parameter array is obtained through coding, the cache picture is drawn according to the pixel parameters in the pixel array, and the cache picture is stored in the cache space correspondingly to the service identifier. The cached pictures are cached in the caching space by drawing the cached data into the cached pictures in a coding mode, so that the leakage of the service data is avoided, and the caching safety of the service data is improved.
Drawings
FIG. 1 is a diagram of an application environment of a data caching method in one embodiment;
FIG. 2 is a flow diagram illustrating a data caching method according to one embodiment;
FIG. 3 is a flowchart illustrating the steps of determining the pixel size of a cached picture in one embodiment;
FIG. 4 is a flowchart illustrating the steps of returning a cached picture to a terminal in one embodiment;
FIG. 5 is a flowchart illustrating the steps of generating a forced recycle notification in one embodiment;
FIG. 6 is a block diagram of a data caching apparatus in one embodiment;
FIG. 7 is a block diagram that illustrates the structure of a picture size determination module in one embodiment;
FIG. 8 is a block diagram of a data caching apparatus in another embodiment;
FIG. 9 is a block diagram of a server in the data caching system, according to one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
FIG. 1 is a diagram of an application environment of a data caching method in one embodiment. Referring to fig. 1, the data caching method is applied to a data caching system. The data caching system comprises a terminal 110 and a server 120, wherein the terminal 110 is connected with the server 120 through a network. The terminal 110 may be a fixed terminal, which may specifically be at least one of a printer, a scanner, and a monitor, or a mobile terminal, which may specifically be at least one of a tablet, a smartphone, a personal data assistant, and a digital camera.
As shown in fig. 2, in an embodiment, a data caching method is provided, which is exemplified by applying the method to the server 120 in fig. 1, and the method specifically includes the following steps:
s202, analyzing the received service data caching request, and extracting service data and a service identifier in the service data caching request through analysis.
Specifically, the terminal 110 displays a service page, periodically acquires service data and a service identifier, and sends the acquired service data and service identifier to the server 120.
In an embodiment, the terminal 110 periodically obtains the service data and the service identifier in the displayed service page, generates a service data caching request according to the obtained service data and the service identifier, and sends the service data caching request to the server 120. The server 120 parses the received service data caching request, and extracts the service data and the service identifier in the service data caching request through parsing.
And S204, determining the pixel size of the cache picture according to the preset image parameter digit and the character digit obtained by counting the service data.
Specifically, after the server 120 acquires the service data, the number of character bits of the service data is counted, and the counted number of character bits is divided by the number of preset image parameter bits to obtain the pixel size of the cache picture.
In one embodiment, the cached picture pixel size includes a cached picture pixel width and a cached picture pixel height, and the cached picture pixel height is a preset value. The server 120 divides the character bit number of the statistical service data by the preset image parameter bit number to obtain the pixel width of the cache picture.
For example, if the predetermined image parameters are in RGBA format, where RGBA represents Red (Red), Green (Green), Blue (Blue), and Alpha (transparency or opacity), the number of bits of the predetermined image parameters is 4. The pixel height of the cache picture is preset to be 1 pixel, the service data is "12345678", the number of character bits of the counted service data is 8, 2 is obtained by dividing 8 by 4, and 2 is the pixel width of the cache picture.
And S206, coding the service data to obtain a pixel parameter array.
Specifically, the server 120 encodes each character in the service data, converts each character into a corresponding pixel parameter through encoding, and obtains a pixel parameter array according to the pixel parameter corresponding to each character.
For example, the service data "12345678" is encoded, each bit of character in the service data is encoded by encoding, so that "51" is obtained by encoding "1", "102" is obtained by encoding "2", "153" is obtained by encoding "3", "204" is obtained by encoding "4", "55" is obtained by encoding "5", "106" is obtained by encoding "6", "157" is obtained by encoding "7", and "208" is obtained by encoding "8", the value of the pixel parameter obtained by encoding is between 0 and 255, and the obtained pixel parameter array is {51, 102, 153, 204, 55, 106, 157, 208 }.
And S208, reading the pixel parameters from the pixel parameter array in sequence according to the preset image parameter digit.
Specifically, the server 120 reads a corresponding number of pixel parameters from the pixel parameter array in sequence according to the preset image parameter bits.
For example, the number of bits of the image parameter in the RGBA format is 4, and the 4 pixel parameters are read from front to back according to the array sequence in the pixel parameter array. The pixel parameter array is {51, 102, 153, 204, 55, 106, 157, 208}, the {51, 102, 153, 204} is read, the read {51, 102, 153, 204} is used as RGBA pixel parameters of the first pixel, the first pixel is constructed according to the read {51, 102, 153, 204}, the {55, 106, 157, 208} is read, the {55, 106, 157, 208} is used as RGBA pixel parameters of the second pixel, the second pixel is constructed according to the read {55, 106, 157, 208}, and a cache picture is obtained according to the first pixel and the second pixel.
And S210, generating a cache picture matched with the pixel size of the cache picture according to the read pixel parameters, and adding the service identifier into the cache picture.
Specifically, the server 120 reads the number of pixel parameters equal to the number of bits of the preset image parameter each time, constructs one pixel according to the pixel parameter read each time, forms a cache picture matched with the pixel size of the cache picture according to the constructed pixel, and adds the service identifier as a picture identifier to the cache picture.
S212, inquiring a cache space corresponding to the service identifier, and storing the cache picture added with the service identifier to the inquired cache space.
Specifically, after generating the cache picture, the server 120 queries the cache space corresponding to the service identifier, and stores the cache picture and the service identifier in the queried cache space correspondingly.
In one embodiment, the server 120 adds the service identifier to the cached image, queries a cached space corresponding to the service identifier, and caches the cached image to which the service identifier is added to the queried cached space.
In this embodiment, the acquired service data is encoded, a pixel parameter array is obtained through encoding, a cache picture is drawn according to pixel parameters in the pixel array, and the cache picture and the service identifier are stored in a cache space correspondingly. The cached pictures are cached in the caching space by drawing the cached data into the cached pictures in a coding mode, so that the leakage of the service data is avoided, and the caching safety of the service data is improved.
As shown in fig. 3, in an embodiment, the step S204 specifically includes a step of determining a pixel size of the cached picture, where the step specifically includes the following steps:
s302, obtaining an encryption mode corresponding to the service identifier.
Specifically, the server 120 stores an encryption mode corresponding to each service identifier. The server 120 queries the encryption scheme corresponding to the service identifier from the stored encryption schemes, and obtains the queried encryption scheme.
S304, encrypting the service data according to the obtained encryption mode to obtain a service data ciphertext.
Specifically, after obtaining the encryption mode corresponding to the service identifier, the server 120 encrypts the service data by using the obtained encryption mode to obtain a service data ciphertext.
S306, counting the character digit of the business data ciphertext.
Specifically, the server 120 counts the number of character bits of the service data ciphertext with respect to the service data ciphertext obtained by the encryption.
And S308, determining the pixel size of the cache picture according to the counted character bit number and the preset image parameter bit number.
Specifically, the server 120 divides the counted number of the character bits by the number of the preset image parameter bits, and if the obtained quotient is an integer, the integer is taken as the cache picture pixel width in the cache picture pixel size; if the obtained quotient has a remainder, rounding and adding 1 to obtain the pixel width of the cache picture; and determining the pixel size of the cached picture according to the calculated width of the picture pixel and the preset height of the picture pixel.
For example, if the service data ciphertext is "12345678", the preset image parameter bit number is 4 bits, the character bit number of the service data ciphertext counted by the server 120 is 8, 2 is obtained by dividing 8 by 4, and the cache picture pixel width in the cache picture pixel size is 2; if the service data ciphertext is "123456789", the preset image parameter bit number is 4 bits, the number of character bits of the service data ciphertext counted by the server 120 is 9, 2 or more is obtained by dividing 9 by 4, and the width of the cache picture pixel in the cache picture pixel size is 2 plus 1 is 3.
In this embodiment, the service data is encrypted according to the encryption mode corresponding to the service identifier to obtain a service data ciphertext, the pixel size of the cache picture is determined according to the number of character bits of the service data ciphertext, the service data ciphertext is converted to be matched with the pixel size of the cache picture, and the security of the service data is improved by encrypting the service data.
In one embodiment, S212 specifically includes the following: inquiring whether a cache picture corresponding to the service identifier exists in a cache space; and if so, deleting the inquired cache picture, and correspondingly storing the generated cache picture and the service identifier.
Specifically, the server 120 queries whether a cache picture corresponding to the service identifier exists in the cache space, and if a cache picture corresponding to the service identifier exists in the cache space, deletes the queried cache picture from the cache space, and stores the generated cache picture and the service identifier in the cache space in a corresponding manner; and if the cache picture corresponding to the service identifier is not inquired in the cache space, directly storing the generated cache picture in the cache space corresponding to the service identifier.
As shown in fig. 4, in an embodiment, after S212, a step of returning a cached picture to the terminal is specifically included, where the step specifically includes the following steps:
s402, receiving a cache data acquisition request sent by the terminal.
Specifically, the terminal 110 detects a cache data obtaining instruction triggered in the service page, obtains a service identifier in the service page according to the cache data obtaining instruction, generates a cache data obtaining request according to the service identifier, and sends the cache data obtaining request to the server 120. The server 120 receives the cache data acquisition request sent by the terminal 110.
S404, inquiring the cache picture from the cache space according to the service identifier in the cache data acquisition request.
Specifically, the server 120 parses the cache data acquisition request after receiving the cache data acquisition request, extracts the service identifier in the cache data acquisition request by parsing, and queries a cache picture from the cache space according to the extracted service identifier.
And S406, returning the inquired cache picture to the terminal.
Specifically, the server 120 sends the cache picture queried in the cache space to the terminal 110 corresponding to the extracted terminal identifier by parsing and extracting the terminal identifier in the cache data obtaining request.
In the embodiment, after the cache data acquisition request sent by the terminal is received, the cache picture is accurately inquired in the cache space according to the service identifier in the cache data acquisition request, and the inquired cache picture is returned to the terminal, so that the accuracy of inquiring the cache picture is improved.
In one embodiment, the following is specifically included after S212: receiving a service end notification sent by a terminal; extracting a service identifier in the service end notification; and deleting the cache picture corresponding to the extracted service identifier from the cache space.
Specifically, when detecting that the service in the service page is ended, the terminal 110 obtains the service identifier, generates a service end notification according to the obtained service identifier, and sends the service end notification to the server 120. After receiving the service end notification, the server 120 parses the service end notification, extracts the service identifier by parsing, queries a cache picture corresponding to the extracted service in the cache space, and deletes the queried cache picture.
In this embodiment, after receiving a service end notification sent by a terminal, a cache picture in a cache space corresponding to a service identifier in the service end notification is deleted, so that a situation that the cache picture related to the ended service occupies the cache space for a long time is avoided, and the cache efficiency of the cache space is improved.
As shown in fig. 5, in an embodiment, the data caching method further includes a step of generating a forced recovery notification, where the step includes the following steps:
and S502, regularly acquiring the space occupancy rate corresponding to each cache space identifier.
Specifically, the server 120 monitors the space occupancy rates of the cache spaces corresponding to the plurality of cache space identifiers, periodically determines the space occupancy rates of the cache spaces, and stores the space occupancy rates corresponding to the cache space identifiers, which are obtained each time.
S504, counting the exceeding times of the space occupancy rate exceeding the preset occupancy rate corresponding to each cache space identifier.
Specifically, the server 120 compares the space occupancy rate corresponding to each stored cache space identifier with a preset occupancy rate, and obtains the number of times that the space occupancy rate corresponding to each cache space identifier exceeds the preset occupancy rate through the comparison.
S506, determining the cache space identifier corresponding to the exceeding times which are greater than the preset times.
Specifically, the server 120 compares the exceeding times corresponding to each cache space identifier with the preset times, and selects the cache space identifier with the exceeding times greater than the preset times by comparison, so that the selected cache space identifier is the determined cache space identifier.
And S508, forcibly recycling the cache space corresponding to the determined cache space identifier.
Specifically, the server 120 queries a cache space corresponding to the determined cache space identifier, deletes the cache picture in the cache space, and clears the cache space, and after the server 120 clears the cache space, a space clearing notification is generated according to each cache space identifier corresponding to the cleared cache space, so as to forcibly recover the cache space.
In one embodiment, the server 120 records the cache space identifier, the recovery time and the recovery capacity of the cache space forcibly recovered, and generates a cache recovery log according to the recorded cache space identifier, recovery time and recovery capacity. The terminal 110 may query the cache reclaim log.
In this embodiment, the space occupancy rates corresponding to the cache space identifiers are periodically obtained, the cache space with the higher long-term space occupancy rate is determined according to the space occupancy rates of the cache space identifiers, the cache space with the higher long-term space occupancy rate is emptied, the cache space is prevented from being occupied for a long time, and the cache space is forcibly recycled, so that the cache efficiency of the cache space is improved.
In an embodiment, the data caching apparatus may also be applied to the terminal 110, an application program is installed in the terminal 110, when the terminal 110 detects that the icon of the application degree is clicked, the application identifier corresponding to the clicked icon is obtained, a network view corresponding to the application identifier is initialized, when the network view is initialized, a data encryption function and a data decryption function are injected into the network view corresponding to the application identifier, the application program corresponding to the application identifier obtains the service data from the server 120, the injected data encryption function is called from the network view corresponding to the application identifier, the data to be cached is encrypted by using the called data encryption function to obtain a cached data ciphertext, a cached picture is generated according to the cached data ciphertext, and the cached picture is cached.
In an embodiment, the terminal 110 detects a cache data obtaining instruction triggered in a page of an application program, extracts a service identifier in the cache data obtaining instruction, queries a cache picture from a local cache space corresponding to the application identifier according to the service identifier, analyzes the cache picture to obtain a pixel parameter array, analyzes the pixel parameter array to obtain a cache data ciphertext, and invokes an injected data decryption function to decrypt the cache data ciphertext to obtain cache data.
In an embodiment, the terminal 110 stores the generated cache picture in the local cache space, and if it is detected that the space capacity of the local cache space is full or the remaining capacity is smaller than the data volume of the cache picture, sends the cache picture to the server 120 corresponding to the application identifier, so that the server 120 stores the cache picture in the cache space corresponding to the application identifier. The server 120 caches the cached pictures sent by the plurality of terminals 110, and the plurality of terminals 110 can all access the cache space in the server 120.
As shown in fig. 6, in an embodiment, a data caching apparatus 600 is provided, which specifically includes the following contents: a service data obtaining module 602, a picture size determining module 604, a pixel array determining module 606, a pixel parameter reading module 608, a cache picture generating module 610 and a cache picture storing module 612.
A service data obtaining module 602, configured to parse the received service data caching request, and extract service data and a service identifier in the service data caching request through parsing.
And the picture size determining module 604 is configured to determine the pixel size of the cached picture according to the preset number of image parameter bits and the number of character bits obtained by counting the service data.
A pixel array determining module 606, configured to encode the service data to obtain a pixel parameter array.
The pixel parameter reading module 608 is configured to read pixel parameters from the pixel parameter array according to a preset number of bits of the image parameter in sequence.
And the cache picture generation module 610 is configured to generate a cache picture matched with the pixel size of the cache picture according to the read pixel parameters, and add the service identifier to the cache picture.
And the cache picture storage module 612 is configured to query a cache space corresponding to the service identifier, and store the cache picture added with the service identifier in the queried cache space.
In this embodiment, the acquired service data is encoded, a pixel parameter array is obtained through encoding, a cache picture is drawn according to pixel parameters in the pixel array, and the cache picture and the service identifier are stored in a cache space correspondingly. The cached pictures are cached in the caching space by drawing the cached data into the cached pictures in a coding mode, so that the leakage of the service data is avoided, and the caching safety of the service data is improved.
As shown in fig. 7, in an embodiment, the picture size determining module 604 specifically includes the following: an encryption mode obtaining module 604a, a service data encryption module 604b, a character digit number counting module 604c and a pixel size determining module 604 d.
The encryption mode obtaining module 604a is configured to obtain an encryption mode corresponding to the service identifier.
The service data encrypting module 604b is configured to encrypt the service data according to the obtained encrypting manner to obtain a service data ciphertext.
And a character digit counting module 604c for counting the character digits of the service data ciphertext.
And a pixel size determining module 604d, configured to determine the pixel size of the cached image according to the counted number of the character bits and the number of the preset image parameter bits.
In this embodiment, the service data is encrypted according to the encryption mode corresponding to the service identifier to obtain a service data ciphertext, and the pixel size of the cache picture is determined according to the character digit number of the service data ciphertext, so that the service data ciphertext is converted to be matched with the pixel size of the cache picture, and the security of the service data is improved by encrypting the service data.
In an embodiment, the cached image storage module 612 is further configured to query whether a cached image corresponding to the service identifier exists in the cached space; and after the cache picture corresponding to the service identifier is inquired, deleting the inquired cache picture, and correspondingly storing the generated cache picture and the service identifier.
In one embodiment, the data caching apparatus 600 further comprises: the cache picture returning module is also used for receiving a cache data acquisition request sent by the terminal; inquiring a cache picture from the cache space according to the service identifier in the cache data acquisition request; and returning the inquired cache picture to the terminal.
In the embodiment, after the cache data acquisition request sent by the terminal is received, the cache picture is accurately inquired in the cache space according to the service identifier in the cache data acquisition request, and the inquired cache picture is returned to the terminal, so that the accuracy of inquiring the cache picture is improved.
In one embodiment, the data caching apparatus 600 further comprises: the cache picture deleting module is used for receiving a service end notification sent by the terminal; extracting a service identifier in the service end notification; and deleting the cache picture corresponding to the extracted service identifier from the cache space.
In this embodiment, after receiving a service end notification sent by a terminal, a cache picture in a cache space corresponding to a service identifier in the service end notification is deleted, so that a situation that the cache picture related to the ended service occupies the cache space for a long time is avoided, and the cache efficiency of the cache space is improved.
As shown in fig. 8, in an embodiment, the data caching apparatus 600 further includes the following contents: an occupancy rate acquisition module 614, a times counting module 616, a space identifier determination module 618 and a space mandatory recycling module 620.
And an occupancy rate obtaining module 614, configured to periodically obtain a space occupancy rate corresponding to each cache space identifier.
The times counting module 616 counts the times of exceeding the preset occupancy rate of the space occupancy rate corresponding to each cache space identifier.
The space identifier determining module 618 determines the cache space identifier corresponding to the number of times exceeding the preset number of times.
And the space mandatory recovery module 620 is configured to perform mandatory recovery on the cache space corresponding to the determined cache space identifier.
In this embodiment, the space occupancy rates corresponding to the cache space identifiers are periodically obtained, the cache space with the higher long-term space occupancy rate is determined according to the space occupancy rates of the cache space identifiers, the cache space with the higher long-term space occupancy rate is emptied, the cache space is prevented from being occupied for a long time, and the cache space is forcibly recycled, so that the cache efficiency of the cache space is improved.
In one embodiment, a computer device is provided, which may be a server or a mobile terminal. When the computer device is a server, its internal structure diagram may be as shown in fig. 9. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a data caching method. Those skilled in the art will appreciate that the architecture shown in fig. 9 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
Embodiments of the present invention provide a server, where the server includes a series of computer programs cached on a memory, and when the computer programs are executed by a processor, the server may implement the data caching method provided in the embodiments of the present invention. In some embodiments, based on the particular operations implemented by the various parts of the computer program.
In one embodiment, a server comprises a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program: analyzing the received service data cache request, and extracting service data and a service identifier in the service data cache request through analysis; determining the pixel size of a cache picture according to the preset image parameter digit and the character digit obtained by counting the service data; coding the service data to obtain a pixel parameter array; reading pixel parameters from the pixel parameter array in sequence according to preset image parameter digits; generating a cache picture matched with the pixel size of the cache picture according to the read pixel parameters, and adding the service identifier into the cache picture; and inquiring a cache space corresponding to the service identifier, and storing the cache picture added with the service identifier to the inquired cache space.
In one embodiment, determining the pixel size of the cached image according to the preset image parameter bit number and the character bit number obtained by counting the service data includes: acquiring an encryption mode corresponding to the service identifier; encrypting the service data according to the obtained encryption mode to obtain a service data ciphertext; counting the character digit of the business data ciphertext; and determining the pixel size of the cached picture according to the counted character bit number and the preset image parameter bit number.
In one embodiment, querying a cache space corresponding to the service identifier, and storing the cache picture added with the service identifier in the queried cache space includes: inquiring whether a cache picture corresponding to the service identifier exists in a cache space; and if the cached picture corresponding to the service identifier exists, deleting the queried cached picture, and correspondingly storing the generated cached picture and the service identifier.
In an embodiment, after querying a cache space corresponding to the service identifier, and storing the cache picture added with the service identifier into the queried cache space corresponding to the service identifier, the processor further implements the following steps when executing the computer program: receiving a cache data acquisition request sent by a terminal; inquiring a cache picture from the cache space according to the service identifier in the cache data acquisition request; and returning the inquired cache picture to the terminal.
In one embodiment, after querying a cache space corresponding to the service identifier, and storing the cache picture added with the service identifier into the queried cache space corresponding to the service identifier, the processor implements the following steps when executing the computer program: receiving a service end notification sent by a terminal; extracting a service identifier in the service end notification; and deleting the cache picture corresponding to the extracted service identifier from the cache space.
In one embodiment, the processor, when executing the computer program, performs the steps of: regularly acquiring space occupancy rates corresponding to the cache space identifications; counting the number of times that the space occupancy rate corresponding to each cache space identifier exceeds the preset occupancy rate; determining a cache space identifier corresponding to the exceeding times which are more than the preset times; and forcibly recovering the cache space corresponding to the determined cache space identifier.
In this embodiment, the acquired service data is encoded, a pixel parameter array is obtained through encoding, a cache picture is drawn according to pixel parameters in the pixel array, and the cache picture and the service identifier are stored in a cache space correspondingly. The cached pictures are cached in the caching space by drawing the cached data into the cached pictures in a coding mode, so that the leakage of the service data is avoided, and the caching safety of the service data is improved.
A computer-readable storage medium, having stored thereon a computer program which, when executed by a processor, causes the processor to perform the steps of: acquiring service data and a service identifier; determining the pixel size of a cache picture according to the number of character bits corresponding to the service data and the number of preset image parameter bits; coding the service data to obtain a pixel parameter array; reading pixel parameters from the pixel parameter array according to preset image parameter digits; generating a cache picture matched with the pixel size of the cache picture according to the read pixel parameters; and storing the cache picture corresponding to the service identifier into a cache space.
In one embodiment, determining the pixel size of the cached image according to the preset image parameter bit number and the character bit obtained by counting the service data includes: acquiring an encryption mode corresponding to the service identifier; encrypting the service data according to the obtained encryption mode to obtain a service data ciphertext; counting the character digit of the business data ciphertext; and determining the pixel size of the cached picture according to the counted character bit number and the preset image parameter bit number.
In one embodiment, querying a cache space corresponding to the service identifier, and storing the cache picture added with the service identifier in the queried cache space includes: inquiring whether a cache picture corresponding to the service identifier exists in a cache space; and if the cached picture corresponding to the service identifier exists, deleting the queried cached picture, and correspondingly storing the generated cached picture and the service identifier.
In one embodiment, after querying a cache space corresponding to the service identifier, and storing the cache picture added with the service identifier into the queried cache space corresponding to the service identifier, the processor further implements the following steps: receiving a cache data acquisition request sent by a terminal; inquiring a cache picture from the cache space according to the service identifier in the cache data acquisition request; and returning the inquired cache picture to the terminal.
In one embodiment, after querying a cache space corresponding to the service identifier, and storing the cache picture added with the service identifier into the queried cache space corresponding to the service identifier, the processor further implements the following steps: receiving a service end notification sent by a terminal; extracting a service identifier in the service end notification; and deleting the cache picture corresponding to the extracted service identifier from the cache space.
In one embodiment, the processor further implements the steps of: regularly acquiring space occupancy rates corresponding to the cache space identifications; counting the number of times that the space occupancy rate corresponding to each cache space identifier exceeds the preset occupancy rate; determining a cache space identifier corresponding to the exceeding times which are more than the preset times; and forcibly recovering the cache space corresponding to the determined cache space identifier.
In this embodiment, the acquired service data is encoded, a pixel parameter array is obtained through encoding, a cache picture is drawn according to pixel parameters in the pixel array, and the cache picture and the service identifier are stored in a cache space correspondingly. The cached pictures are cached in the caching space by drawing the cached data into the cached pictures in a coding mode, so that the leakage of the service data is avoided, and the caching safety of the service data is improved.
It will be understood by those skilled in the art that all or part of the processes of the methods of the above embodiments may be implemented by a computer program, which is stored in a computer readable storage medium and can include the processes of the above embodiments. The storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), and the like.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method for caching data, the method comprising:
analyzing the received service data cache request, and extracting service data and a service identifier in the service data cache request through analysis;
acquiring an encryption mode corresponding to the service identifier, encrypting the service data according to the acquired encryption mode to obtain a service data ciphertext, counting the character digit of the service data ciphertext, and determining the pixel size of the cache picture according to the preset image parameter digit and the counted character digit;
coding the service data to obtain a pixel parameter array;
reading pixel parameters from the pixel parameter array in sequence according to the preset image parameter digit;
generating a cache picture matched with the pixel size of the cache picture according to the read pixel parameters, and adding the service identifier into the cache picture;
and inquiring a cache space corresponding to the service identifier, and storing the cache picture added with the service identifier to the inquired cache space.
2. The method according to claim 1, wherein the querying a cache space corresponding to the service identifier, and storing the cache picture added with the service identifier to the queried cache space comprises:
inquiring whether a cache picture corresponding to the service identifier exists in a cache space;
and if so, deleting the inquired cache picture, and correspondingly storing the generated cache picture and the service identifier.
3. The method according to claim 2, wherein the querying a cache space corresponding to the service identifier, and after storing the cache picture added with the service identifier to the queried cache space corresponding to the service identifier, comprises:
receiving a cache data acquisition request sent by a terminal;
inquiring a cache picture from the cache space according to the service identifier in the cache data acquisition request;
and returning the inquired cache picture to the terminal.
4. The method according to claim 1, wherein the querying a cache space corresponding to the service identifier, and after storing the cache picture added with the service identifier to the queried cache space corresponding to the service identifier, comprises:
receiving a service end notification sent by a terminal;
extracting the service identifier in the service end notification;
and deleting the cache picture corresponding to the extracted service identifier from the cache space.
5. The method according to any one of claims 1-4, further comprising:
regularly acquiring space occupancy rates corresponding to the cache space identifications;
counting the number of times that the space occupancy rate corresponding to each cache space identifier exceeds the preset occupancy rate;
determining a cache space identifier corresponding to the exceeding times which are more than the preset times;
and forcibly recovering the cache space corresponding to the determined cache space identifier.
6. A data caching apparatus, comprising:
the service data acquisition module is used for analyzing the received service data cache request and extracting service data and a service identifier in the service data cache request through analysis;
the picture size determining module is used for acquiring an encryption mode corresponding to the service identifier, encrypting the service data according to the acquired encryption mode to obtain a service data ciphertext, counting the character digit of the service data ciphertext, and determining the pixel size of the cache picture according to the preset image parameter digit and the obtained character digit;
the pixel array determining module is used for coding the service data to obtain a pixel parameter array;
the pixel parameter reading module is used for reading pixel parameters from the pixel parameter array in sequence according to the preset image parameter digit;
the cache picture generation module is used for generating a cache picture matched with the pixel size of the cache picture according to the read pixel parameters and adding the service identifier into the cache picture;
and the cache picture storage module is used for inquiring the cache space corresponding to the service identifier and storing the cache picture added with the service identifier to the inquired cache space.
7. The apparatus of claim 6, wherein the cache picture storage module comprises:
the query unit is used for querying whether a cache picture corresponding to the service identifier exists in a cache space;
and the storage unit is used for deleting the inquired cache picture and correspondingly storing the generated cache picture and the service identifier if the inquired cache picture exists.
8. The apparatus of claim 6, wherein the data caching apparatus further comprises a cache picture returning module; the cache picture returning module is used for receiving a cache data acquisition request sent by the terminal; inquiring a cache picture from the cache space according to the service identifier in the cache data acquisition request; and returning the inquired cache picture to the terminal.
9. A server comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the method of any one of claims 1 to 5 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 5.
CN201711319134.XA 2017-12-12 2017-12-12 Data caching method, device, server and storage medium Active CN108259563B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711319134.XA CN108259563B (en) 2017-12-12 2017-12-12 Data caching method, device, server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711319134.XA CN108259563B (en) 2017-12-12 2017-12-12 Data caching method, device, server and storage medium

Publications (2)

Publication Number Publication Date
CN108259563A CN108259563A (en) 2018-07-06
CN108259563B true CN108259563B (en) 2021-01-12

Family

ID=62722526

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711319134.XA Active CN108259563B (en) 2017-12-12 2017-12-12 Data caching method, device, server and storage medium

Country Status (1)

Country Link
CN (1) CN108259563B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109614347B (en) * 2018-10-22 2023-07-21 中国平安人寿保险股份有限公司 Processing method and device for multi-level cache data, storage medium and server
CN110413644B (en) * 2019-06-17 2023-07-25 中国平安人寿保险股份有限公司 Data caching method, electronic device and computer readable storage medium
CN111753228A (en) * 2019-09-24 2020-10-09 北京京东尚科信息技术有限公司 Data request method and device, computer readable medium and electronic equipment
CN113254480B (en) * 2020-02-13 2024-04-19 中国移动通信集团广东有限公司 Data query method and device
CN115174757A (en) * 2022-06-08 2022-10-11 广州鲁邦通智能科技有限公司 Form information submitting method, reading method and processing system

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105577684A (en) * 2016-01-25 2016-05-11 北京京东尚科信息技术有限公司 Anti-crawling methods, server, client and system

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030105879A1 (en) * 2001-11-30 2003-06-05 Erlend Olson Wireless network architecture and method
CN103246830B (en) * 2013-04-28 2016-04-13 小米科技有限责任公司 The cipher processing method of client script and device and decipher processing method and device
CN103701929A (en) * 2014-01-02 2014-04-02 中安消技术有限公司 Method and device for realizing business data caching
CN106789856A (en) * 2015-11-25 2017-05-31 阿里巴巴集团控股有限公司 A kind of information coding method, coding/decoding method and device
CN105608147B (en) * 2015-12-17 2019-05-21 无锡天脉聚源传媒科技有限公司 A kind of method and device of hiding picture original address
CN106897141A (en) * 2015-12-21 2017-06-27 北京奇虎科技有限公司 The processing method and processing device of information

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105577684A (en) * 2016-01-25 2016-05-11 北京京东尚科信息技术有限公司 Anti-crawling methods, server, client and system

Also Published As

Publication number Publication date
CN108259563A (en) 2018-07-06

Similar Documents

Publication Publication Date Title
CN108259563B (en) Data caching method, device, server and storage medium
CN107801165B (en) Business short message pushing method and device, computer equipment and storage medium
CN102970307B (en) Cipher safety system and password safety method
US7870388B2 (en) Page encryption system
US8738928B2 (en) Apparatus and method for processing extension information in image files
US11303617B2 (en) Methods and apparatuses for oblivious transfer using trusted environment
CN102098508A (en) Multimedia signature coding and decoding
CN112437060B (en) Data transmission method and device, computer equipment and storage medium
CN103414840A (en) Data hiding method based on image set
CN112073444B (en) Data set processing method and device and server
Benedict Improved file security system using multiple image steganography
US20110099369A1 (en) File encryption system and method
WO2021196960A1 (en) Encrypted video call method and apparatus, and device and storage medium
CN114257562A (en) Instant messaging method, instant messaging device, electronic equipment and computer readable storage medium
CN113704206B (en) Metadata processing method and device, electronic equipment and storage medium
CN107800758B (en) Wind control data processing method, device and system
CN114936012A (en) Method and device for realizing screen projection by encrypting and scanning two-dimensional code
CN109417585A (en) Method for compressing image, image recovery method, image compressing device, image restoration device, image compression program product and image restoration program product
CN112383888A (en) Short message system, method and equipment
CN113051592A (en) File encryption method and device, electronic equipment and storage medium
CN113282662B (en) Block information processing method, device, equipment and medium
Boughaci et al. Stochastic local search combined with LSB technique for image steganography
CN112073174B (en) Communication account decryption method, device, equipment, storage medium and information interaction system
CN113438506B (en) Video file restoration method and device, computer equipment and storage medium
CN111698534B (en) Video processing method and device, electronic equipment and storage medium

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