The content of the invention
The present invention provides a kind of, is used to solve the backstage of moodle websites in the prior art will be data cached
, it is necessary to set up text in real time first when storing in the text, then again by data cached storage in text
In this, so that data cached process is slower, the operational efficiency for reducing the backstage of moodle websites is asked
Topic.
It is an aspect of the present invention to provide a kind of data cache method based on moodle websites, including:
It is data cached that the backstage of acquisition website generates, and the website is based on moodle Development of Software Package
Website;
To it is described it is data cached carry out serializing treatment, generation string format it is data cached;
Data cached by string format is sent to redis database servers, so that the redis numbers
The data cached of string format is stored according to storehouse server.
In method as described above, the backstage of the acquisition website generate it is data cached before, also wrap
Include:
Receive the server address of the redis database servers of user input;
Accordingly, it is described that the data cached of string format is sent to redis database servers, including:
By the data cached of string format, the redis databases indicated by the server address are sent to
Server.
In method as described above, the backstage generation of the acquisition website it is data cached, including:
Determine data cached RX path;
According to the data cached RX path, obtain website backstage generation it is data cached.
In method as described above, the data cached of string format is sent to redis databases described
Server so that the redis database servers by string format it is data cached stored after,
Also include:
The data processing request that the backstage of the website sends is received, and determines that receiving the data processing asks
Very first time when asking;
The data processing request is sent to the redis database servers, so that the redis numbers
According to storehouse server data processing request is asked it is data cached process after generate result;
The result that the redis database servers send is received, and determines to receive the result
When the second time;
Determine the time difference of the very first time and the second time;
According to the default cost time, whether the time difference is determined more than the cost time, to generate
Data cached treatment comparative result, wherein, the cost time is that the backstage of the website carries out textual data
The time spent during according to caching.
Another aspect of the present invention is to provide a kind of data buffer storage device based on moodle websites, including:
Acquisition module, it is data cached that the backstage for obtaining website generates, and the website is based on moodle
The website of Development of Software Package;
Processing module, for it is described it is data cached carry out serializing treatment, generation string format it is slow
Deposit data;
Sending module, for the data cached of string format to be sent into redis database servers, with
The redis database servers are made to be stored the data cached of string format.
In device as described above, also include:
Receiver module, for the acquisition module obtain website backstage generation it is data cached before,
Receive the server address of the redis database servers of user input;
Accordingly, the sending module, specifically for:
By the data cached of string format, the redis databases indicated by the server address are sent to
Server.
In device as described above, the acquisition module, specifically for:
Determine data cached RX path;
According to the data cached RX path, obtain website backstage generation it is data cached.
In device as described above, the sending module is sent to by the data cached of string format
Redis database servers so that the redis database servers by string format it is data cached enter
After row storage, it is additionally operable to:
The data processing request that the backstage of the website sends is received, and determines that receiving the data processing asks
Very first time when asking;
The data processing request is sent to the redis database servers, so that the redis numbers
According to storehouse server data processing request is asked it is data cached process after generate result;
The result that the redis database servers send is received, and determines to receive the result
When the second time;
Determine the time difference of the very first time and the second time;
According to the default cost time, whether the time difference is determined more than the cost time, to generate
Data cached treatment comparative result, wherein, the cost time is that the backstage of the website carries out textual data
The time spent during according to caching.
It is data cached that backstage by obtaining website of the invention generates, and the website is soft based on moodle
Part unwraps the website of hair;To the data cached caching for carrying out serializing treatment, generating string format
Data;Data cached by string format is sent to redis database servers, so that the redis
Database server is stored the data cached of string format.Realizing will be based on moodle software
Data cached storage that the website of hair produces eventually is unwrapped in redis database servers, caching number is improve
According to efficiency, improve the operational efficiency on the backstage of moodle websites.
Specific embodiment
To make the purpose, technical scheme and advantage of the embodiment of the present invention clearer, below in conjunction with this hair
Accompanying drawing in bright embodiment, is clearly and completely described to the technical scheme in the embodiment of the present invention,
Obviously, described embodiment is a part of embodiment of the invention, rather than whole embodiments.It is based on
Embodiment in the present invention, those of ordinary skill in the art are obtained under the premise of creative work is not made
The every other embodiment for obtaining, belongs to the scope of protection of the invention.
Fig. 1 is the flow of the data cache method based on moodle websites that the embodiment of the present invention one is provided
Figure, as shown in figure 1, the method for the present embodiment includes:
It is data cached that step 101, the backstage of acquisition website generate, and website is based on moodle software kits
The website of exploitation.
In the present embodiment, specifically, moodle is increase income a learning management software kit, development of user
The website of network courses can be gone out using moodle Development of Software Package, accessing user can be on website to net
Network pleasure into being classified and being searched for, by learned lesson the need for oneself.During website is by use,
Can get website backstage generation it is data cached.
Step 102, carry out serializing treatment to data cached, generation string format it is data cached.
In the present embodiment, specifically, carrying out serializing treatment to data cached, such that it is able to generate word
Accord with the data cached of string format.
Step 103, the data cached of string format is sent to redis database servers, so that redis
Database server is stored the data cached of string format.
In the present embodiment, specifically, creating redis plug-in units in the backstage of moodle websites.redis
A key-value storage system, it support character string (String, abbreviation string), chained list (List,
Abbreviation list), set (Set, abbreviation set), ordered set (Sorted set, abbreviation zset) and Hash
Etc. type.For example, redis plug-in units first can be being write, the net based on moodle Development of Software Package
Under the cache/stores catalogues stood, redis catalogues, catalogue storage redis plug-in card programs are created;Wherein,
Redis plug-in units include lang/en/cachestore_redis.php:Language pack, the survey for testing caching performance
Examination file tests/lib_test.php, the file for configuring redis server address informations
Addinstanceform.php, core bag lib.php:Redis, obtains the file of redis server address informations
Settings.php, and redis plug-in units version information file version.php;Redis plug-in units are copied to
Under the cache/stores/redis catalogues of the website based on moodle Development of Software Package, keeper's account is used
Number accessing can be just installed in terminal redis based on the website of moodle Development of Software Package.
Such that it is able to the data cached of the string format that obtains step 102, sent by redis plug-in units
The data cached of string format is deposited to redis database servers, redis database servers
Storage.Meanwhile, can by redis plug-in units can periodically update data cached write-in redis data
In the disk of storehouse server, or by redis plug-in units the data cached write-in redis data changed
In the additional log file of storehouse server.
The present embodiment is by obtaining the caching number that the backstage of the website based on moodle Development of Software Package generates
According to carrying out generating the data cached of string format after serializing treatment to data cached, by character string lattice
The data cached of formula is sent to redis database servers, so that redis database servers will cache number
According to being stored.It is achieved thereby that the data cached of the website end generation of moodle Development of Software Package will be based on
Store in redis database servers, improve data cached efficiency, improve moodle websites
Backstage operational efficiency.
Fig. 2 is the flow of the data cache method based on moodle websites that the embodiment of the present invention two is provided
Figure, as shown in Fig. 2 on the basis of embodiment one, before the step 101 in embodiment one, also
Including:
The server address of step 201, the redis database servers of reception user input.
In the present embodiment, specifically, user can set in the website based on moodle Development of Software Package
Put the server address of redis database servers.For example, can be based on moodle software kits
The website of exploitation " portal management->Plug-in unit->Caching->Buffer memory->Match somebody with somebody under Redis " catalogues
Put the server address of redis database servers.
Accordingly, step 103, specifically includes:
By the data cached of string format, the redis database services indicated by server address are sent to
Device.
In the present embodiment, specifically, the redis database servers determined according to user in step 201
Server address, the redis database servers indicated by it are determined, so as to by the slow of string format
Deposit data is sent to the redis database servers indicated by server address.
The present embodiment is by receiving the server address of the redis database servers of user input, so as to incite somebody to action
The data cached redis database servers being sent to indicated by server address of string format, so that
User can also change the server address of redis database servers, be easy to based on moodle software kits
The data cached caching of the website of exploitation.
Further, on the basis of above-described embodiment, step 101 is specifically included:
Determine data cached RX path;
According to data cached RX path, obtain website backstage generation it is data cached.
In the present embodiment, specifically, being generated in the backstage of the website based on moodle Development of Software Package
One data cached RX path, by data cached RX path, goes to obtain based on moodle software kits
It is data cached that the backstage of the website of exploitation generates.
Further, on the basis of above-described embodiment, step 102 is by the caching number of string format
According to being sent to redis database servers, so that redis database servers are by the caching of string format
After data are stored, also include:
Receive the data processing request that the backstage of website sends, and when determining to receive data processing request the
One time;
Data processing request is sent to redis database servers, so that redis database servers pair
Data processing request asked it is data cached processed after generate result;
When receiving the result that redis database servers send, and determining reception processing result second
Time;
Determine the time difference of the very first time and the second time;
According to the default cost time, whether the time difference is determined more than the cost time, it is data cached to generate
Treatment comparative result, wherein, the cost time carries out what is spent when text data is cached by the backstage of website
Time.
In the present embodiment, specifically, the backstage of the website based on moodle Development of Software Package can be received
The data processing request of transmission, the data processing request can obtain data cached request or setting
The requests such as the data cached request of request or deletion of data cached value;Meanwhile, determine reception number
Very first time during according to treatment request.The data processing request is sent to redis database servers, redis
Database server data processing request is asked it is data cached process after generate result;
If data processing request is to obtain data cached request, the acquisition successful result of data can be generated;
If data processing request is to delete data cached request, the deletion successful result of data can be generated.
Then the result that redis database servers are returned is received, and when determining to receive the result the
Two times.Second time was subtracted into the very first time, the time difference of the very first time and the second time is obtained.In advance
First there is provided a cost time, the cost time is the backstage of the website based on moodle Development of Software Package
Carry out the time spent when text data is cached;The process of text data caching is, soft based on moodle
Part unwraps the backstage of the moodle websites of hair when by data cached storage in the text, builds in real time first
Text is erected, is then stored data cached in the text again.Compare the size of cost time and time difference,
Whether the time difference is determined more than the cost time, so as to generate a data cached treatment comparative result;If when
Between difference be less than the cost time so that generation data cached treatment comparative result be shown as currently pass through redis
Database goes the data cached mode of website of the caching based on moodle Development of Software Package, better than textual data
The data cached mode of website of the caching based on moodle Development of Software Package is gone according to caching;If the time difference is big
In the time of cost, so that the data cached treatment comparative result of generation is shown as, text data caching goes to delay
The data cached mode of the website based on moodle Development of Software Package is deposited, better than by redis databases
Go the data cached mode of website of the caching based on moodle Development of Software Package.Shown according to test, when
Between difference be less than the cost time, so as to remove caching based on moodle Development of Software Package by redis databases
The data cached mode of website, goes caching to be based on moodle Development of Software Package better than text data caching
The data cached mode of website.For example, can be by the website based on moodle Development of Software Package
" portal management->Plug-in unit->Caching->Under Test performance " catalogues, carry out data cached
Caching performance is tested.
Present embodiment by whether according to the default cost time, determining the time difference more than the cost time,
Data cached treatment comparative result is generated, wherein, the cost time is delayed for the backstage of website carries out text data
The time spent when depositing;So that it is determined that going caching to be unwrapped based on moodle softwares by redis databases
The data cached mode of the website of hair, goes caching to be unwrapped based on moodle softwares better than text data caching
The data cached mode of the website of hair.
Fig. 3 is that the structure of the data buffer storage device based on moodle websites that the embodiment of the present invention three is provided is shown
It is intended to, as shown in figure 3, the data buffer storage device based on moodle websites that the present embodiment is provided, including:
Acquisition module 31, it is data cached that the backstage for obtaining website generates, and website is based on moodle
The website of Development of Software Package;
Processing module 32, for the data cached caching for carrying out serializing treatment, generating string format
Data;
Sending module 33, for the data cached of string format to be sent into redis database servers,
So that redis database servers are stored the data cached of string format.
The executable embodiment of the present invention one of the data buffer storage device based on moodle websites of the present embodiment is carried
The data cache method based on moodle websites for supplying, its realization principle is similar, and here is omitted.
The present embodiment is by obtaining the caching number that the backstage of the website based on moodle Development of Software Package generates
According to carrying out generating the data cached of string format after serializing treatment to data cached, by character string lattice
The data cached of formula is sent to redis database servers, so that redis database servers will cache number
According to being stored.It is achieved thereby that the data cached of the website end generation of moodle Development of Software Package will be based on
Store in redis database servers, improve data cached efficiency, improve moodle websites
Backstage operational efficiency.
Fig. 4 is that the structure of the data buffer storage device based on moodle websites that the embodiment of the present invention four is provided is shown
Be intended to, on the basis of embodiment three, as shown in figure 4, the present embodiment provide based on moodle websites
Data buffer storage device, also include:
Receiver module 41, for acquisition module 31 obtain website backstage generation it is data cached before,
Receive the server address of the redis database servers of user input;
Accordingly, sending module 33, specifically for:
By the data cached of string format, the redis database services indicated by server address are sent to
Device.
Acquisition module 31, specifically for:
Determine data cached RX path;
According to data cached RX path, obtain website backstage generation it is data cached.
Sending module 33 the data cached of string format is sent into redis database servers, with
Make redis database servers by string format it is data cached stored after, be additionally operable to:
Receive the data processing request that the backstage of website sends, and when determining to receive data processing request the
One time;
Data processing request is sent to redis database servers, so that redis database servers pair
Data processing request asked it is data cached processed after generate result;
When receiving the result that redis database servers send, and determining reception processing result second
Time;
Determine the time difference of the very first time and the second time;
According to the default cost time, whether the time difference is determined more than the cost time, it is data cached to generate
Treatment comparative result, wherein, the cost time carries out what is spent when text data is cached by the backstage of website
Time.
The executable embodiment of the present invention two of the data buffer storage device based on moodle websites of the present embodiment with
And the data cache method based on moodle websites provided in above-mentioned implementation method, its realization principle is similar
Seemingly, here is omitted.
The present embodiment is by receiving the server address of the redis database servers of user input, so as to incite somebody to action
The data cached redis database servers being sent to indicated by server address of string format, so that
User can also change the server address of redis database servers, be easy to based on moodle software kits
The data cached caching of the website of exploitation;And realize the website based on moodle Development of Software Package
The data cached storage for producing eventually improves data cached efficiency in redis database servers, carries
The operational efficiency on the backstage of moodle websites high.By according to the default cost time, determining the time difference
Whether it is more than the cost time, generates data cached treatment comparative result, wherein, it is website to spend the time
Backstage carries out the time spent when text data is cached;So that it is determined that going to cache base by redis databases
In the data cached mode of the website of moodle Development of Software Package, go to cache base better than text data caching
In the data cached mode of the website of moodle Development of Software Package.
One of ordinary skill in the art will appreciate that:Realize all or part of step of above-mentioned each method embodiment
Suddenly can be completed by the related hardware of programmed instruction.Foregoing program can be stored in a computer can
In reading storage medium.The program upon execution, performs the step of including above-mentioned each method embodiment;And
Foregoing storage medium includes:ROM, RAM, magnetic disc or CD etc. are various can be with store program codes
Medium.
Finally it should be noted that:The above embodiments are merely illustrative of the technical solutions of the present invention, rather than to it
Limitation;Although being described in detail to the present invention with reference to the foregoing embodiments, the ordinary skill of this area
Personnel should be understood:It can still modify to the technical scheme described in foregoing embodiments, or
Person carries out equivalent to which part technical characteristic;And these modifications or replacement, do not make corresponding skill
The essence of art scheme departs from the spirit and scope of various embodiments of the present invention technical scheme.