Caching write-in, read method and the device of object-oriented
Technical field
The present invention relates to a kind of write-in of the caching of caching technology field more particularly to object-oriented, read method and devices.
Background technique
For extensive Web (webpage) system, number of users is very big, causes the load of server very high, therefore magnetic
Disk readwrite performance is low, needs to use memory as caching and improves the performance of whole system.Caching can be directly to most of
User provides service, the External memory equipment for avoiding each request access performance of user low, to improve entire system
The efficiency of system.Therefore, cache is particularly important for the performance for improving whole system.
Existing extensive Web system is developed usually using object oriented language.Object-oriented is that a kind of software is opened
Forwarding method is referred in programming using encapsulation, is inherited and the design methods such as polymorphic.Encapsulation refers to and will deposit in real world
The attribute of some object bound together with behavior, and be placed in a logic unit.The logic unit is responsible for institute
The attribute of description stashes, and all access of outer bound pair object built-in attribute can only be realized by the user interface of offer.This
Sample does the protective effect that can not only play to object attribute, but also the maintainability of software systems can be improved.Object is that people want
The anything studied can regard object as from simple integer to complicated aircraft etc., it can not only indicate specific
Things, moreover it is possible to indicate abstract rule, plan or event.Object has state, and an object describes its shape with data value
State.Object there are also operate, for changing the state of object, object and its operation be exactly object behavior.Object implementatio8 data
With the combination of operation, it is packaged in data and operation in the entity of object.Class is the object with identical characteristic and behavior
It is abstract.Therefore, class is the abstract of object, and object is the materialization of class, it may also be said to, object is the example of class.Class is actually
A kind of data type.For example, parrot can be considered as a type, and a specific parrot can be considered as an object.Class has
Attribute, it is the abstract of the state of object, and the attribute of class is described with data structure.Class has operation, it is the behavior of object
It is abstract, with operation name and realize the method for the operation and describe.
Caching refers to the buffer area of data exchange, when a certain hardware will read data, can search from caching first
The data needed, if having found directly execute, can not find if if from next stage storage equipment in search.Due to caching
Read or write speed is more faster than next stage storage equipment, therefore caching can help whole system quickly to run.Cache work
Principle is " locality of reference ", including temporal locality and spatial locality.Temporal locality refers to when some data is interviewed
After asking once, how long do not cross will be accessed again;Spatial locality refers to CPU (Central
Processing Unit, central processing unit) some data is at a time needed, then being likely to just need its attached in next step
Close data.For application program, either the localized phenomena quoted can all occur in instruction stream or data flow.Due to
The read or write speed of the memory of computer is significantly faster than the read or write speed of hard disk, therefore can be temporary by the data read from hard disk
Be stored in memory, later using the data when just do not have to have read from hard disk again, thus substantially increase whole
The read or write speed of body, the principle of locality that this process is namely based on reference above-mentioned are used using memory as the caching of hard disk.
Existing extensive Web system is developed usually using object oriented language, but current caching technology can not
It is well adapted for the exploitation demand of Object-Oriented Systems.Specifically, when using caching technology in Object-Oriented Systems at present,
Agreement can not be general between each class, and research staff needs to separately design serializing and unserializing agreement for each class, with
And developed and debugged respectively for each class, cause to take considerable time, and be easy error, whole process inefficiency.
Summary of the invention
Technical problem
In view of this, the technical problem to be solved by the present invention is to existing caching technology is suitable in Object-Oriented Systems
Answering property is poor, causes development efficiency lower.
Solution
In order to solve the above-mentioned technical problem, an embodiment according to the present invention, the caching for providing a kind of object-oriented are write
Enter method, comprising:
In the case where receiving write request, general object memory interface is called;
Determine that said write requests the unique identifier of corresponding object to be written by the general object memory interface,
And the key of the object to be written is generated according to the unique identifier;
By the general object memory interface according to parameter type as defined in preset protocol and parameter format will it is described to
Write-in object sequence turns to stream, and the preset protocol can be used in the serializing of any class;
The stream is written according to the key by the general object memory interface and is cached.
For the above method, in one possible implementation, passing through the general object memory interface according to institute
State key by the stream write-in caching after, the method also includes:
External memory equipment is written into the stream according to the key.
For the above method, in one possible implementation, by the general object memory interface according to default
The object sequence to be written is turned to stream by parameter type and parameter format as defined in agreement, comprising:
All parameter types as defined in the preset protocol are determined by the general object memory interface, and are determined
The parameter value of the corresponding all parameter types of the object to be written;
It, will be described default by the general object memory interface according to the parameter format as defined in the preset protocol
The parameter value of the information of agreement and the corresponding all parameter types of the object to be written is converted to stream.
For the above method, in one possible implementation, the parameter type includes: the name of class belonging to object
Claim parameter, whole Property Name parameters of the object, whole attribute value parameters of the object, the object all methods
Name parameter, class belonging to the object create the complete of class belonging to the name parameter of method of the object, the object
Whole attribute value parameters of class belonging to subordinate's property name parameter and the object.
In order to solve the above-mentioned technical problem, according to another embodiment of the present invention, a kind of caching of object-oriented is provided
Read method, comprising:
In the case where receiving inquiry request, determine that the inquiry request is corresponding by general object query interface
Key;
If finding the corresponding stream of the key from the caching by the general object query interface, according to default
The stream is deserialized as object by parameter type and parameter format as defined in agreement, and the preset protocol can be used in any class
Unserializing;
The object is returned to by the general object query interface, to respond the inquiry request.
For the above method, in one possible implementation, by being looked into described in the determination of general object query interface
It askes after requesting corresponding key, the method also includes:
If stream corresponding less than the key is searched from the caching by the general object query interface, from outside
The corresponding stream of the key is searched in storage equipment;
If finding the corresponding stream of the key from the External memory equipment, according to institute as defined in the preset protocol
It states parameter type and the parameter format and the stream is deserialized as the object, and return to the object, described in response
Inquiry request.
For the above method, in one possible implementation, according to parameter type as defined in preset protocol and parameter
The stream is deserialized as object by format, comprising:
The information of the preset protocol is obtained from the stream, and described preset is determined according to the information of the preset protocol
The parameter type and the parameter format as defined in agreement;
In the parameter type and the parameter format according to as defined in the preset protocol and the stream it is all described in
The stream is deserialized as the object by the parameter value of parameter type.
For the above method, in one possible implementation, the parameter type includes: the name of class belonging to object
Claim parameter, whole Property Name parameters of the object, whole attribute value parameters of the object, the object all methods
Name parameter, class belonging to the object create the complete of class belonging to the name parameter of method of the object, the object
Whole attribute value parameters of class belonging to subordinate's property name parameter and the object.
In order to solve the above-mentioned technical problem, according to another embodiment of the present invention, a kind of caching of object-oriented is provided
Writing station, comprising:
General object memory interface calling module, for calling general object to deposit in the case where receiving write request
Store up interface;
Key generation module, it is corresponding to be written right for determining that said write is requested by the general object memory interface
The unique identifier of elephant, and generate according to the unique identifier key of the object to be written;
Serialization module is used for through the general object memory interface according to parameter type as defined in preset protocol and ginseng
The object sequence to be written is turned to stream by number format, and the preset protocol can be used in the serializing of any class;
Writing module is cached, is cached for the stream to be written according to the key by the general object memory interface.
For above-mentioned apparatus, in one possible implementation, described device further include:
External memory equipment writing module, for External memory equipment to be written in the stream according to the key.
For above-mentioned apparatus, in one possible implementation, the serialization module includes:
Parameter value determines submodule, for determining institute as defined in the preset protocol by the general object memory interface
There is the parameter type, and determines the parameter value of the corresponding all parameter types of the object to be written;
Submodule is serialized, is used for through the general object memory interface according to the ginseng as defined in the preset protocol
Number format turns the parameter value of the information of the preset protocol and the corresponding all parameter types of the object to be written
It is changed to stream.
For above-mentioned apparatus, in one possible implementation, the parameter type includes: the name of class belonging to object
Claim parameter, whole Property Name parameters of the object, whole attribute value parameters of the object, the object all methods
Name parameter, class belonging to the object create the complete of class belonging to the name parameter of method of the object, the object
Whole attribute value parameters of class belonging to subordinate's property name parameter and the object.
In order to solve the above-mentioned technical problem, according to another embodiment of the present invention, a kind of caching of object-oriented is provided
Reading device, comprising:
Key determining module, in the case where receiving inquiry request, determined by general object query interface described in
The corresponding key of inquiry request;
Unserializing module, if for finding the key pair from the caching by the general object query interface
The stream is then deserialized as object according to parameter type as defined in preset protocol and parameter format by the stream answered, described default
Agreement can be used in the unserializing of any class;
First inquiry response module, for returning to the object by the general object query interface, described in response
Inquiry request.
For above-mentioned apparatus, in one possible implementation, described device further include:
First searching module, if for being searched from the caching less than the key by the general object query interface
Corresponding stream then searches the corresponding stream of the key from External memory equipment;
Second inquiry response module, if being pressed for finding the corresponding stream of the key from the External memory equipment
The stream is deserialized as the object according to the parameter type as defined in the preset protocol and the parameter format, and is returned
The object is returned, to respond the inquiry request.
For above-mentioned apparatus, in one possible implementation, the unserializing module includes:
Parameter type and format determine submodule, for obtaining the information of the preset protocol from the stream, and according to
The information of the preset protocol determines the parameter type and the parameter format as defined in the preset protocol;
Unserializing submodule is used for the parameter type and the parameter format according to as defined in the preset protocol,
And in the stream all parameter types parameter value, the stream is deserialized as the object.
For above-mentioned apparatus, in one possible implementation, the parameter type includes: the name of class belonging to object
Claim parameter, whole Property Name parameters of the object, whole attribute value parameters of the object, the object all methods
Name parameter, class belonging to the object create the complete of class belonging to the name parameter of method of the object, the object
Whole attribute value parameters of class belonging to subordinate's property name parameter and the object.
Beneficial effect
By encapsulation general object memory interface and general object query interface, setting can be used in the serializing of any class
With the preset protocol of unserializing, caching wiring method, read method and the device of object-oriented according to an embodiment of the present invention
Object oriented language can be combined with caching, can be inquired and be connect by the general object memory interface and general object of encapsulation
Cause for gossip is now directly accessed the object in object oriented language, to greatly reduce development amount, improve exploitation portability and
Efficiency, and the read-write load of External memory equipment can be reduced, the readwrite performance bottleneck problem of External memory equipment is solved, thus greatly
It is big to improve system performance;It is applied to by caching wiring method, read method and the device of the object-oriented of the embodiment of the present invention
In the case where server end, the access speed of server can be greatly improved, support is higher concurrent, thus same subscriber amount institute
The number of servers needed greatly reduces.
According to below with reference to the accompanying drawings becoming to detailed description of illustrative embodiments, other feature of the invention and aspect
It is clear.
Detailed description of the invention
Comprising in the description and constitute the attached drawing of part of specification and specification together illustrate it is of the invention
Exemplary embodiment, feature and aspect, and principle for explaining the present invention.
Fig. 1 shows the implementation flow chart of the caching wiring method of object-oriented according to an embodiment of the invention;
Fig. 2 shows showing for another implementation flow chart of the caching wiring method of object-oriented according to an embodiment of the invention
It is intended to;
Fig. 3 shows the specific implementation stream of the caching wiring method step S103 of object-oriented according to an embodiment of the invention
The schematic diagram of journey figure;
Fig. 4 shows the implementation flow chart of the caching read method of object-oriented according to an embodiment of the invention;
Fig. 5 shows showing for another implementation flow chart of the caching read method of object-oriented according to an embodiment of the invention
It is intended to;
Fig. 6 is shown in the caching read method step S402 of object-oriented according to an embodiment of the invention according to default association
Stream is deserialized as the schematic diagram of the specific implementation flow chart of object by parameter type as defined in discussing and parameter format;
Fig. 7 shows the structural block diagram of the caching writing station of object-oriented according to an embodiment of the invention;
Fig. 8 shows the structural block diagram of the caching reading device of object-oriented according to an embodiment of the invention;
Fig. 9 shows an illustrative structural frames of the caching writing station of object-oriented according to an embodiment of the invention
Figure;
Figure 10 shows an illustrative structural frames of the caching reading device of object-oriented according to an embodiment of the invention
Figure.
Specific embodiment
Below with reference to attached drawing various exemplary embodiments, feature and the aspect that the present invention will be described in detail.It is identical in attached drawing
Appended drawing reference indicate element functionally identical or similar.Although the various aspects of embodiment are shown in the attached drawings, remove
It non-specifically points out, it is not necessary to attached drawing drawn to scale.
Dedicated word " exemplary " means " being used as example, embodiment or illustrative " herein.Here as " exemplary "
Illustrated any embodiment should not necessarily be construed as preferred or advantageous over other embodiments.
In addition, in order to better illustrate the present invention, numerous details is given in specific embodiment below.
It will be appreciated by those skilled in the art that without certain details, the present invention equally be can be implemented.In some instances, for
Method, means, element and circuit well known to those skilled in the art are not described in detail, in order to highlight purport of the invention.
Embodiment 1
Fig. 1 shows the implementation flow chart of the caching wiring method of object-oriented according to an embodiment of the invention.Such as Fig. 1 institute
Show, this method specifically includes that
In step s101, in the case where receiving write request, general object memory interface is called.
It should be noted that the embodiment of the present invention can be adapted in any system developed based on object oriented language,
Such as it can be applied in the background server of website.
Wherein, general object memory interface can be the general-purpose interface for storing the object of class, for external call.It calls
The object of any class can be directly written in the general object memory interface into the caching of Object-Oriented Systems.
In embodiments of the present invention, in the case where external interface is to write request, it is general right that external interface calls
As memory interface, so that the corresponding object to be written of the write request is written into caching for general object memory interface.
In step s 102, unique mark of the corresponding object to be written of write request is determined by general object memory interface
Know symbol, and generates the key of object to be written according to unique identifier.
Wherein, the unique identifier of object to be written may include a kind of Property Name and the attribute-name of object to be written
Claim corresponding attribute value, which can be uniquely determined according to the attribute value, thus the unique identifier can be used as
Access mark.It can be with according to the key that unique identifier generates object to be written are as follows: the character string for being converted to unique identifier
Key as object to be written.
In step s 103, by general object memory interface according to parameter type as defined in preset protocol and parameter format
It is written into object sequence and turns to stream, preset protocol can be used in the serializing of any class.
Wherein, stream can be byte stream or character stream, be not limited thereto.Byte stream is made of byte, character
Stream is made of character.In embodiments of the present invention, byte stream can refer to that be written into object is packaged into according to preset protocol
A series of successive bytes;Character stream can refer to that being written into object is packaged into a series of continuation characters according to preset protocol.Class can
Think the class that any one object oriented language defines, object is the example of class.
In embodiments of the present invention, it can be pre-designed the general preset protocol for the serializing that can be used in any class,
The preset protocol can be called by general object memory interface, object is written in the buffer to realize.Due to without being each
Class separately designs agreement, to greatly reduce development amount, improves exploitation convenience and development efficiency.
In step S104, stream write-in is cached according to key by general object memory interface.
In embodiments of the present invention, memory can be used as storage equipment in caching.Caching can depositing using key-value pair
Hash table can be used as data structure in storage mode, and key can be an arbitrary character string, and value is also possible to one arbitrarily
Character string, the corresponding value of key.Hash table can determine the storage location of value according to key, to realize Constant Grade
It searches, update and deletes.In embodiments of the present invention, the value in key-value pair can refer to stream.
Wherein, step S104 is specifically as follows: being based on hash algorithm according to key by general object memory interface and writes stream
Enter caching.
The embodiment of the present invention will be encapsulated as general object memory interface to the process of caching write-in object, call this general right
It, can directly will be in the object write-in caching of the class in object oriented language as memory interface.
Exist in a kind of possible implementation, before step S101, this method further include: class is instantiated, generate to
Object is written, and assignment is carried out to the object to be written according to each attribute of such definition.
Fig. 2 shows showing for another implementation flow chart of the caching wiring method of object-oriented according to an embodiment of the invention
It is intended to.As shown in Fig. 2, this method specifically includes that
In step s 201, in the case where receiving write request, general object memory interface is called;
In step S202, unique mark of the corresponding object to be written of write request is determined by general object memory interface
Know symbol, and generates the key of object to be written according to unique identifier;
In step S203, by general object memory interface according to parameter type as defined in preset protocol and parameter format
It is written into object sequence and turns to stream, preset protocol can be used in the serializing of any class;
In step S204, stream write-in is cached according to key by general object memory interface;
In step S205, stream is written by External memory equipment according to key.
In one possible implementation, after being cached stream write-in according to key by general object memory interface, root
External memory equipment is written into stream according to key.Herein, External memory equipment can be hard disk, be not limited thereto.External storage
Equipment is used for permanent memory.
Fig. 3 shows the specific implementation stream of the caching wiring method step S103 of object-oriented according to an embodiment of the invention
The schematic diagram of journey figure.As shown in figure 3, by general object memory interface according to parameter type as defined in preset protocol and parameter lattice
Formula is written into object sequence and turns to stream, comprising:
In step S301, all parameter types as defined in preset protocol are determined by general object memory interface, and really
Determine the parameter value of the corresponding all parameter types of object to be written;
In step s 302, by general object memory interface according to parameter format as defined in preset protocol, by default association
The parameter value of the information of view and the corresponding all parameter types of object to be written is converted to stream.
Wherein, the information of preset protocol may include the mark of preset protocol and the version number of preset protocol.Parameter format
It may include the sequence of parameters in stream.Parameter format can also include the coding standard of parameter, for example, the coding mark of parameter
Standard is ASCII (American Standard Code for Information Interchange, Unite States Standard information exchange
Code).
In one possible implementation, parameter type includes: the name parameter of class belonging to object, the whole of object
Property Name parameter, whole attribute value parameters of object, the name parameter of all methods of object, the creation pair of class belonging to object
Whole attribute values ginseng of class belonging to the whole Property Name parameters and object of class belonging to the name parameter of the method for elephant, object
Number etc..
For example, the parameter of object to be written includes: whole categories of the title of class belonging to object to be written, object to be written
Property title, whole attribute values of object to be written, the title of all methods of object to be written, the wound of class described in object to be written
Belonging to the whole Property Names and object to be written for building class belonging to the title of the method for the object to be written, object to be written
Whole attribute values of class.
In this way, by encapsulation general object memory interface, setting can be used in the preset protocol of the serializing of any class, root
Object oriented language can be combined with caching, can be passed through according to the caching wiring method of the object-oriented of the embodiment of the present invention
The general object memory interface of encapsulation realizes the object write direct in object oriented language, to greatly reduce development
Amount, improves the portability and efficiency of exploitation, and can reduce the read-write load of External memory equipment, solves the reading of External memory equipment
Write performance bottleneck problem, to greatly improve system performance;By the caching wiring method of the object-oriented of the embodiment of the present invention
In the case where applied to server end, the access speed of server can be greatly improved, support is higher concurrent, thus identical use
Number of servers required for family is measured greatly reduces.
Embodiment 2
Fig. 4 shows the implementation flow chart of the caching read method of object-oriented according to an embodiment of the invention.Such as Fig. 4 institute
Show, this method specifically includes that
In step S401, in the case where receiving inquiry request, determine that inquiry is asked by general object query interface
Seek corresponding key.
Wherein, general object query interface can be the general-purpose interface that the object of class is inquired according to inquiry request, for outside
It calls.Calling the general object query interface directly can inquire and obtain from the caching of object-oriented according to inquiry request pair
As, i.e., the general object query interface return the result is that object.The general object query interface supports the inquiry to any class.
In embodiments of the present invention, determine that the corresponding key of inquiry request can be with by general object query interface are as follows: pass through
General object query interface determines that the corresponding querying condition of inquiry request, map listing according to the pre-stored data determine querying condition
Corresponding key.
In step S402, if the corresponding stream of key is found from caching by general object query interface, according to pre-
If stream is deserialized as object by parameter type and parameter format as defined in agreement, preset protocol can be used in the inverted sequence of any class
Columnization.
After determining the corresponding key of inquiry request by general object query interface, pass through general object query interface root
Hash algorithm is based on according to key to be searched in the buffer.
In embodiments of the present invention, the general default association for the unserializing that can be used in any class can be pre-designed
View, can call the preset protocol by general object query interface, to realize query object in the buffer.Due to without being every
A class separately designs agreement, to greatly reduce development amount, improves exploitation convenience and development efficiency.
In step S403, by general object query interface returning an object value, to respond inquiry request.
In embodiments of the present invention, after stream is deserialized as object by general object query interface, general object
Object is supplied to external interface by query interface.
The embodiment of the present invention is encapsulated as general object by will obtain the process for flowing and being deserialized as object from caching
Query interface calls the general object query interface, can be directly from the object of the class read in object oriented language in caching.
Fig. 5 shows showing for another implementation flow chart of the caching read method of object-oriented according to an embodiment of the invention
It is intended to.As shown in figure 5, this method specifically includes that
In step S501, in the case where receiving inquiry request, determine that inquiry is asked by general object query interface
Seek corresponding key.
In step S502, if the corresponding stream of key is found from caching by general object query interface, according to pre-
If stream is deserialized as object by parameter type and parameter format as defined in agreement, preset protocol can be used in the inverted sequence of any class
Columnization.
In step S503, by general object query interface returning an object value, to respond inquiry request.
In step S504, if searching stream corresponding less than key from caching by general object query interface, from outer
Portion stores the corresponding stream of key for searching in equipment.
In step S505, if the corresponding stream of key is found from External memory equipment, according to as defined in preset protocol
Stream is deserialized as object, and returning an object value by parameter type and parameter format, to respond inquiry request.
Fig. 6 is shown in the caching read method step S402 of object-oriented according to an embodiment of the invention according to default association
Stream is deserialized as the schematic diagram of the specific implementation flow chart of object by parameter type as defined in discussing and parameter format.Such as Fig. 6 institute
Show, stream be deserialized as object according to parameter type as defined in preset protocol and parameter format, comprising:
In step s 601, the information of preset protocol is obtained from stream, and default association is determined according to the information of preset protocol
Parameter type as defined in discussing and parameter format;
In step S602, all parameter classes in parameter type and parameter format according to as defined in preset protocol, and stream
Stream is deserialized as object by the parameter value of type.
Wherein, the information of preset protocol may include the mark of preset protocol and the version number of preset protocol.According to default
The mark of agreement and the version number of preset protocol, can determine parameter type and parameter format as defined in preset protocol, so as to
To determine all parameter types and parameter format in stream.
In one possible implementation, parameter type includes: the name parameter of class belonging to object, the whole of object
Property Name parameter, whole attribute value parameters of object, the name parameter of all methods of object, the creation pair of class belonging to object
Whole attribute values ginseng of class belonging to the whole Property Name parameters and object of class belonging to the name parameter of the method for elephant, object
Number etc..
In this way, setting can be used in the preset protocol of the unserializing of any class by encapsulation general object query interface,
The caching read method of object-oriented according to an embodiment of the present invention can combine object oriented language with caching, Neng Goutong
It crosses general object query interface and realizes that the object directly read in object oriented language mentions to greatly reduce development amount
The portability and efficiency of height exploitation, and the read-write load of External memory equipment can be reduced, solve the read-write of External memory equipment
Energy bottleneck problem, to greatly improve system performance;By the caching read method application of the object-oriented of the embodiment of the present invention
In the case where server end, the access speed of server can be greatly improved, support is higher concurrent, thus same subscriber amount
Required number of servers greatly reduces.
Embodiment 3
Fig. 7 shows the structural block diagram of the caching writing station of object-oriented according to an embodiment of the invention.The device can
Think server, or other caching writing stations are not limited thereto.For ease of description, it illustrates only and this hair
The relevant part of bright embodiment.As shown in fig. 7, the device includes:
General object memory interface calling module 71, for calling general object in the case where receiving write request
Memory interface;
Key generation module 72, for determining the corresponding object to be written of write request only by general object memory interface
One identifier, and generate according to unique identifier the key of object to be written;
Serialization module 73, for passing through general object memory interface according to parameter type as defined in preset protocol and parameter
Format is written into object sequence and turns to stream, and preset protocol can be used in the serializing of any class;
Writing module 74 is cached, for caching to be written in stream according to key by general object memory interface.
In one possible implementation, device further include:
External memory equipment writing module 75, for External memory equipment to be written in stream according to key.
In one possible implementation, serialization module 73 includes:
Parameter value determines submodule 731, for determining all ginsengs as defined in preset protocol by general object memory interface
Several classes of types, and determine the parameter value of the corresponding all parameter types of object to be written;
Submodule 732 is serialized, is used for through general object memory interface according to parameter format as defined in preset protocol, it will
The parameter value of the information of preset protocol and the corresponding all parameter types of object to be written is converted to stream.
In one possible implementation, parameter type includes: the name parameter of class belonging to object, the whole of object
Property Name parameter, whole attribute value parameters of object, the name parameter of all methods of object, the creation pair of class belonging to object
Whole attribute values ginseng of class belonging to the whole Property Name parameters and object of class belonging to the name parameter of the method for elephant, object
Number etc..
In this way, by encapsulation general object memory interface, setting can be used in the preset protocol of the serializing of any class, root
Object oriented language can be combined with caching, can be passed through according to the caching writing station of the object-oriented of the embodiment of the present invention
The general object memory interface of encapsulation realizes the object write direct in object oriented language, to greatly reduce development
Amount, improves the portability and efficiency of exploitation, and can reduce the read-write load of External memory equipment, solves the reading of External memory equipment
Write performance bottleneck problem, to greatly improve system performance;By the caching writing station of the object-oriented of the embodiment of the present invention
In the case where applied to server end, the access speed of server can be greatly improved, support is higher concurrent, thus identical use
Number of servers required for family is measured greatly reduces.
Embodiment 4
Fig. 8 shows the structural block diagram of the caching reading device of object-oriented according to an embodiment of the invention.The device can
Think server, or other caching reading devices are not limited thereto.For ease of description, it illustrates only and this hair
The relevant part of bright embodiment.As shown in figure 8, the device includes:
Key determining module 81, for being looked by the determination of general object query interface in the case where receiving inquiry request
It askes and requests corresponding key;
Unserializing module 82, if for finding the corresponding stream of key from caching by general object query interface,
Stream is deserialized as object according to parameter type as defined in preset protocol and parameter format, preset protocol can be used in any class
Unserializing;
First inquiry response module 83, for passing through general object query interface returning an object value, to respond inquiry request.
In one possible implementation, device further include:
First searching module 84, if for searching stream corresponding less than key from caching by general object query interface,
The then corresponding stream of key for searching from External memory equipment;
Second inquiry response module 85, if for finding the corresponding stream of key from External memory equipment, according to default
Stream is deserialized as object, and returning an object value by parameter type and parameter format as defined in agreement, to respond inquiry request.
In one possible implementation, unserializing module 82 includes:
Parameter type and format determine submodule 821, for obtaining the information of preset protocol from stream, and according to default association
The information of view determines parameter type and parameter format as defined in preset protocol;
Unserializing submodule 822 is used for institute in parameter type and parameter format according to as defined in preset protocol, and stream
There is the parameter value of parameter type, stream is deserialized as object.
In one possible implementation, parameter type includes: the name parameter of class belonging to object, the whole of object
Property Name parameter, whole attribute value parameters of object, the name parameter of all methods of object, the creation pair of class belonging to object
Whole attribute values ginseng of class belonging to the whole Property Name parameters and object of class belonging to the name parameter of the method for elephant, object
Number etc..
In this way, setting can be used in the preset protocol of the unserializing of any class by encapsulation general object query interface,
The caching reading device of object-oriented according to an embodiment of the present invention can combine object oriented language with caching, Neng Goutong
It crosses general object query interface and realizes that the object directly read in object oriented language mentions to greatly reduce development amount
The portability and efficiency of height exploitation, and the read-write load of External memory equipment can be reduced, solve the read-write of External memory equipment
Energy bottleneck problem, to greatly improve system performance;By the caching reading device application of the object-oriented of the embodiment of the present invention
In the case where server end, the access speed of server can be greatly improved, support is higher concurrent, thus same subscriber amount
Required number of servers greatly reduces.
Embodiment 5
It is one illustrative to show a kind of caching writing station of object-oriented of another embodiment of the invention by Fig. 9
Structural block diagram.The caching writing station 1100 of the object-oriented can be the host server for having computing capability, personal meter
Calculation machine PC or portable portable computer or terminal etc..The specific embodiment of the invention is not to the specific of calculate node
Realization limits.
The caching writing station 1100 of the object-oriented includes processor (processor) 1110, communication interface
(Communications Interface) 1120, memory (memory) 1130 and bus 1140.Wherein, processor 1110,
Communication interface 1120 and memory 1130 pass through bus 1140 and complete mutual communication.
Communication interface 1120 is used for and network device communications, and wherein the network equipment includes such as Virtual Machine Manager center, is total to
Enjoy storage etc..
Processor 1110 is for executing program.Processor 1110 may be a central processor CPU or dedicated collection
At circuit ASIC (Application Specific Integrated Circuit), or it is arranged to implement the present invention
One or more integrated circuits of embodiment.
Memory 1130 is for storing file.Memory 1130 may include high speed RAM memory, it is also possible to further include non-
Volatile memory (non-volatile memory), for example, at least a magnetic disk storage.Memory 1130 is also possible to deposit
Memory array.Memory 1130 is also possible to by piecemeal, and described piece can be combined into virtual volume by certain rule.
In a kind of possible embodiment, above procedure can be the program code for including computer operation instruction.The journey
Sequence specifically may include instructions for performing the following operations:
In the case where receiving write request, general object memory interface is called;
Determine that said write requests the unique identifier of corresponding object to be written by the general object memory interface,
And the key of the object to be written is generated according to the unique identifier;
By the general object memory interface according to parameter type as defined in preset protocol and parameter format will it is described to
Write-in object sequence turns to stream, and the preset protocol can be used in the serializing of any class;
The stream is written according to the key by the general object memory interface and is cached.
Assuming that above-mentioned is the first possible embodiment, then provided based on the first possible embodiment
Second of possible embodiment in, which also may include instructions for performing the following operations:
It, will according to the key after being cached stream write-in according to the key by the general object memory interface
External memory equipment is written in the stream.
In the third the possible embodiment provided based on the first possible embodiment, the program is also
May include instructions for performing the following operations:
By the general object memory interface according to parameter type as defined in preset protocol and parameter format will it is described to
Write-in object sequence turns to stream, comprising:
All parameter types as defined in the preset protocol are determined by the general object memory interface, and are determined
The parameter value of the corresponding all parameter types of the object to be written;
It, will be described default by the general object memory interface according to the parameter format as defined in the preset protocol
The parameter value of the information of agreement and the corresponding all parameter types of the object to be written is converted to stream.
The first, second or the 4th kind of possible implementation providing based on the third possible embodiment
In mode, which also may include instructions for performing the following operations:
The parameter type includes: the name parameter of class belonging to object, whole Property Name parameters of the object, institute
It states described in whole attribute value parameters of object, the name parameter of all methods of the object, the creation of class belonging to the object
Class belonging to whole Property Name parameters of class belonging to the name parameter of the method for object, the object and the object it is complete
Subordinate's property value parameter.
Embodiment 6
Figure 10 shows a kind of the one exemplary of the caching reading device of object-oriented of another embodiment of the invention
Structural block diagram.The caching reading device 1200 of the object-oriented can be the host server for having computing capability, individual
Computer PC or portable portable computer or terminal etc..The specific embodiment of the invention is not to the tool of calculate node
Body realization limits.
The caching reading device 1200 of the object-oriented includes processor 1210, communication interface 1220, memory 1230
With bus 1240.Wherein, processor 1210, communication interface 1220 and memory 1230 are completed each other by bus 1240
Communication.
Communication interface 1220 is used for and network device communications, and wherein the network equipment includes such as Virtual Machine Manager center, is total to
Enjoy storage etc..
Processor 1210 is for executing program.Processor 1210 may be a central processor CPU or dedicated collection
At circuit ASIC, or it is arranged to implement one or more integrated circuits of the embodiment of the present invention.
Memory 1230 is for storing file.Memory 1230 may include high speed RAM memory, it is also possible to further include non-
Volatile memory, for example, at least a magnetic disk storage.Memory 1230 is also possible to memory array.Memory 1230 is also
May be by piecemeal, and described piece can be combined into virtual volume by certain rule.
In a kind of possible embodiment, above procedure can be the program code for including computer operation instruction.The journey
Sequence specifically may include instructions for performing the following operations:
In the case where receiving inquiry request, determine that the inquiry request is corresponding by general object query interface
Key;
If finding the corresponding stream of the key from the caching by the general object query interface, according to default
The stream is deserialized as object by parameter type and parameter format as defined in agreement, and the preset protocol can be used in any class
Unserializing;
The object is returned to by the general object query interface, to respond the inquiry request.
Assuming that above-mentioned is the first possible embodiment, then provided based on the first possible embodiment
Second of possible embodiment in, which also may include instructions for performing the following operations:
After determining the corresponding key of the inquiry request by general object query interface, if passing through the general object
Query interface searches stream corresponding less than the key from the caching, then it is corresponding that the key is searched from External memory equipment
Stream;
If finding the corresponding stream of the key from the External memory equipment, according to institute as defined in the preset protocol
It states parameter type and the parameter format and the stream is deserialized as the object, and return to the object, described in response
Inquiry request.
In the 4th kind of possible embodiment provided based on the first or second of possible embodiment,
The program also may include instructions for performing the following operations:
The stream is deserialized as object according to parameter type as defined in preset protocol and parameter format, comprising:
The information of the preset protocol is obtained from the stream, and described preset is determined according to the information of the preset protocol
The parameter type and the parameter format as defined in agreement;
In the parameter type and the parameter format according to as defined in the preset protocol and the stream it is all described in
The stream is deserialized as the object by the parameter value of parameter type.
In the 4th kind of possible embodiment provided based on the first or second of possible embodiment,
The program also may include instructions for performing the following operations:
The parameter type includes: the name parameter of class belonging to object, whole Property Name parameters of the object, institute
It states described in whole attribute value parameters of object, the name parameter of all methods of the object, the creation of class belonging to the object
Class belonging to whole Property Name parameters of class belonging to the name parameter of the method for object, the object and the object it is complete
Subordinate's property value parameter.
Those of ordinary skill in the art may be aware that each example modules and algorithm in embodiment described herein
Step can be realized with the combination of electronic hardware or computer software and electronic hardware.These functions actually with hardware also
It is software form to realize, the specific application and design constraint depending on technical solution.Professional technician can be directed to
It is specific that described function is realized using different methods is selected, but this realization is it is not considered that exceed model of the invention
It encloses.
If realizing the function and when sold or used as an independent product in the form of computer software,
To a certain extent it is believed that all or part (such as the part that contributes to existing technology) of technical solution of the present invention is
It embodies in form of a computer software product.The computer software product is generally stored inside computer-readable non-volatile
In storage medium, including some instructions are used so that computer equipment (can be personal computer, server or network to set
It is standby etc.) execute all or part of the steps of various embodiments of the present invention method.And storage medium above-mentioned include USB flash disk, mobile hard disk,
Read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic
The various media that can store program code such as dish or CD.
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, any
Those familiar with the art in the technical scope disclosed by the present invention, can easily think of the change or the replacement, and should all contain
Lid is within protection scope of the present invention.Therefore, protection scope of the present invention should be based on the protection scope of the described claims.