Structured cache for persistent objects
First Claim
1. Computer readable code for increasing efficiency of reading persistent objects from a database by creating and using a structured cache in a computer system, comprising:
- a subprocess for retrieving a result set from said database in response to a database query, said result set comprising one or more rows of data elements;
a subprocess for creating a data cache from said retrieved result set; and
a subprocess for creating an associations cache from said retrieved result set.
2 Assignments
0 Petitions
Accused Products
Abstract
A technique for creating and using a structured cache to increase the efficiency of reading persistent objects from a database. The structured cache is comprised of an object cache, an associations cache, and a data cache. Data read-ahead is used to retrieve rows from a relational database in advance of an application'"'"'s need for the data. Entries are created in the data cache and association cache as the rows are processed. The data cache stores data in unstructured binary format, delaying the expense of instantiation until an object is requested by the application. At that time, data is retrieved from the data cache, an object is instantiated from the data, and an entry is created in the object cache. This approach also saves storage space that would be wasted if objects were instantiated upon retrieval, but never used. The association cache stores members of an association, organized by member key within owner key for each association. According to the preferred embodiment, maintaining cache consistency is not required, further increasing the efficiency gains that can be realized using this technique.
-
Citations
34 Claims
-
1. Computer readable code for increasing efficiency of reading persistent objects from a database by creating and using a structured cache in a computer system, comprising:
-
a subprocess for retrieving a result set from said database in response to a database query, said result set comprising one or more rows of data elements;
a subprocess for creating a data cache from said retrieved result set; and
a subprocess for creating an associations cache from said retrieved result set.
-
-
2. Computer readable code for increasing efficiency of reading persistent objects from a database by creating and using a structured cache in a computer system, comprising:
-
a subprocess for retrieving a result set from said database in response to a database query, said result set comprising one or more rows of data elements;
a subprocess for creating a data cache from said retrieved result set; and
a subprocess for responding to a request for access to an object by an executing program in said computer system, comprising;
a subprocess for locating an entry corresponding to said object in said data cache;
a subprocess for instantiating and hydrating said object from said located entry;
a subprocess for registering said instantiated and hydrated object in an object cache; and
a subprocess for returning said instantiated and hydrated object to said executing program. - View Dependent Claims (3, 4)
a subprocess for locating said requested object in said object cache using said register; and
a subprocess for returning said located object to said executing program.
-
-
5. Computer readable code for increasing efficiency of reading persistent objects from a database by creating and using a structured cache in a computer system, comprising:
-
a subprocess for retrieving a result set from said database in response to a database query, said result set comprising one or more rows of data elements;
a subprocess for creating a data cache from said retrieved result set; and
a subprocess for creating an object cache entry for an object corresponding to data stored in said data cache, comprising;
a subprocess for locating an entry corresponding to said stored data in said data cache;
a subprocess for instantiating and hydrating said object from said located entry; and
a subprocess for registering said instantiated and hydrated object in said object cache by creating said object cache entry. - View Dependent Claims (6, 7, 8, 9, 10, 11, 12, 13)
a subprocess for searching said object cache for said selected object using a result of said subprocess for registering;
a subprocess for returning said selected object if said subprocess for searching said object cache locates said selected object;
a subprocess for searching said data cache for said entry corresponding to said selected object if said subprocess for searching said object cache fails to locate said selected object;
wherein said subprocess for creating an object cache entry is invoked if said subprocess for searching said data cache locates said entry; and
a subprocess for issuing a further database query if said subprocess for searching said data cache fails to locate said entry.
-
-
8. Computer readable code according to claim 6, further comprising a subprocess for navigating associations represented by said result set using said associations cache, in response to a request for one or more member objects of a selected association, comprising:
-
a subprocess for searching said associations cache to locate a member key collection corresponding to said selected association, said member key collection comprised of one or more member primary keys;
a subprocess for retrieving said member key collection from said database by issuing a second database query if said subprocess for searching fails to locate said member key collection in said associations cache;
a subprocess for locating each member object associated with said member key collection in said associations cache if said subprocess for searching locates said member key collection; and
a subprocess for returning said located member objects as a response to said first request.
-
-
9. Computer readable code according to claim 5, wherein said subprocess for creating a data cache further comprises:
-
a subprocess for extracting a primary key for each object in each row of said result set;
a subprocess for extracting corresponding data for each object from said row if said primary key does not already exist in said data cache; and
a subprocess for storing said extracted primary key and said extracted corresponding data as said entry corresponding to said object in said data cache.
-
-
10. Computer readable code according to claim 9, wherein access to said data cache uses a data cache look-up table, and wherein said data cache look-up table is comprised of a collection of said stored primary keys and, for each of said stored primary keys, a corresponding pointer to said stored extracted corresponding data.
-
11. Computer readable code according to claim 6, wherein said subprocess for creating an associations cache further comprises:
-
a subprocess for defining one or more association types for said associations cache;
a subprocess for storing association cache entries corresponding to said defined association types; and
a subprocess for populating said associations cache, said subprocess for populating further comprising;
a subprocess for extracting zero or more foreign keys for each object in each row of said result set;
a subprocess for storing each extracted foreign key as an owner key, said owner key being associated with a particular one of said stored association cache entries and being unique within said particular one; and
a subprocess for storing a member primary key corresponding to each extracted foreign key, said member primary key being associated with a particular one of said stored owner keys.
-
-
12. Computer readable code according to claim 11, wherein access to said associations cache uses an associations cache look-up table, and wherein said associations cache look-up table is comprised of a collection of said stored association cache entries, said stored owner keys, and said stored member primary keys, organized according to said stored member primary keys within said stored owner keys within said stored association cache entries.
-
13. Computer readable code according to claim 5, wherein access to said object cache uses an object cache look-up table, wherein said object cache look-up table is comprised of a collection of object identifiers, one of said object identifiers corresponding to each of said registered objects, and wherein said object cache look-up table is organized according to said object identifiers.
-
14. Computer readable code for enabling object navigation to be independent of a data access path used on a query that retrieves data from a database, comprising:
-
a subprocess for creating an associations cache, wherein said associations cache comprises an entry for each association in said retrieved data; and
a subprocess for retrieving one or more member objects of a selected one of said associations from said created associations cache.
-
-
15. A system for creating and using a structured cache to increase the efficiency of reading persistent objects from a database in a computing environment, comprising:
-
means for retrieving a result set from said database in response to a database query, said result set comprising one or more rows of data elements;
means for creating a data cache from said retrieved result set; and
means for responding to a request for access to an object by an executing program in said computer system, comprising;
means for locating an entry corresponding to said object in said data cache;
means for instantiating and hydrating said object from said located entry;
means for registering said instantiated and hydrated object in an object cache; and
means for returning said instantiated and hydrated object to said executing program. - View Dependent Claims (16, 17)
means for locating said requested object in said object cache using said register; and
means for returning said located object to said executing program.
-
-
18. A system for creating and using a structured cache to increase the efficiency of reading persistent objects from a database in a computing environment, comprising:
-
means for retrieving a result set from said database in response to a database query, said result set comprising one or more rows of data elements;
means for creating a data cache from said retrieved result set; and
means for creating an object cache entry for an object corresponding to data stored in said data cache, comprising;
means for locating an entry corresponding to said stored data in said data cache;
means for instantiating and hydrating said object from said located entry; and
means for registering said instantiated and hydrated object in said object cache by creating said object cache entry. - View Dependent Claims (19, 20, 21, 22, 23)
means for searching said object cache for said selected object using a result of said means for registering;
means for returning said selected object if said means for searching said object cache locates said selected object;
means for searching said data cache for said entry corresponding to said selected object if said means for searching said object cache fails to locate said selected object;
wherein said means for creating an object cache entry is invoked if said means for searching said data cache locates said entry; and
means for issuing a further database query if said means for searching said data cache fails to locate said entry.
-
-
21. The system according to claim 19, further comprising means for navigating associations represented by said result set using said associations cache, in response to a request for one or more member objects of a selected association, comprising:
-
means for searching said associations cache to locate a member key collection corresponding to said selected association, said member key collection comprised of one or more member primary keys;
means for retrieving said member key collection from said database by issuing a second database query if said means for searching fails to locate said member key collection in said associations cache;
means for locating each member object associated with said member key collection in said associations cache if said means for searching locates said member key collection; and
means for returning said located member objects as a response to said first request.
-
-
22. The system according to claim 18, wherein said means for creating a data cache further comprises:
-
means for extracting a primary key for each object in each row of said result set;
means for extracting corresponding data for each object from said row if said primary key does not already exist in said data cache; and
means for storing said extracted primary key and said extracted corresponding data as said entry corresponding to said object in said data cache.
-
-
23. The system according to claim 19, wherein said means for creating an associations cache further comprises:
-
means for defining one or more association types for said associations cache;
means for storing association cache entries corresponding to said defined association types; and
means for populating said associations cache, said means for populating further comprising;
means for extracting zero or more foreign keys for each object in each row of said result set;
means for storing each extracted foreign key as an owner key, said owner key being associated with a particular one of said stored association cache entries and being unique within said particular one; and
means for storing a member primary key corresponding to each extracted foreign key, said member primary key being associated with a particular one of said stored owner keys.
-
-
24. A system for enabling object navigation to be independent of a data access path used on a query that retrieves data from a database in a computing environment, comprising:
-
means for creating an associations cache, wherein said associations cache comprises an entry for each association in said retrieved data; and
means for retrieving one or more member objects of a selected one of said associations from said created associations cache.
-
-
25. A method for creating and using a structured cache to increase the efficiency of reading persistent objects from a database in a computing environment, comprising the steps of:
-
retrieving a result set from said database in response to a database query, said result set comprising one or more rows of data elements;
creating a data cache from said retrieved result set; and
responding to a request for access to an object by an executing program in said computer system, comprising the steps of;
locating an entry corresponding to said object in said data cache;
instantiating and hydrating said object from said located entry;
registering said instantiated and hydrated object in an object cache; and
returning said instantiated and hydrated object to said executing program. - View Dependent Claims (26, 27)
locating said requested object in said object cache using said register; and
returning said located object to said executing program.
-
-
28. A method for creating and using a structured cache to increase the efficiency of reading persistent objects from a database in a computing environment, comprising the steps of:
-
retrieving a result set from said database in response to a database query, said result set comprising one or more rows of data elements;
creating a data cache from said retrieved result set; and
creating an object cache entry for an object corresponding to data stored in said data cache, comprising the steps of;
locating an entry corresponding to said stored data in said data cache;
instantiating and hydrating said object from said located entry; and
registering said instantiated and hydrated object in said object cache by creating said object cache entry. - View Dependent Claims (29, 30, 31, 32, 33)
searching said object cache for said selected object using a result of said step of registering;
returning said selected object if said step of searching said object cache locates said selected object;
searching said data cache for said entry corresponding to said selected object if said step of searching said object cache fails to locate said selected object;
wherein said step of creating an object cache entry is invoked if said step of searching said data cache locates said entry; and
issuing a further database query if said step of searching said data cache fails to locate said entry.
-
-
31. The method according to claim 29, further comprising the step of navigating associations represented by said result set using said associations cache, in response to a request for one or more member objects of a selected association, comprising the steps of:
-
searching said associations cache to locate a member key collection corresponding to said selected association, said member key collection comprised of one or more member primary keys;
retrieving said member key collection from said database by issuing a second database query if said step of searching fails to locate said member key collection in said associations cache;
locating each member object associated with said member key collection in said associations cache if said step of searching locates said member key collection; and
returning said located member objects as a response to said first request.
-
-
32. The method according to claim 28, wherein said step of creating a data cache further comprises the steps of:
-
extracting a primary key for each object in each row of said result set;
extracting corresponding data for each object from said row if said primary key does not already exist in said data cache; and
storing said extracted primary key and said extracted corresponding data as said entry corresponding to said object in said data cache.
-
-
33. The method according to claim 29, wherein said step of creating an associations cache further comprises the steps of:
-
defining one or more association types for said associations cache;
storing association cache entries corresponding to said defined association types; and
populating said associations cache, said step of populating further comprising the steps of;
extracting zero or more foreign keys for each object in each row of said result set;
storing each extracted foreign key as an owner key, said owner key being associated with a particular one of said stored association cache entries and being unique within said particular one; and
storing a member primary key corresponding to each extracted foreign key, said member primary key being associated with a particular one of said stored owner keys.
-
-
34. A method for enabling object navigation to be independent of a data access path used on a query that retrieves data from a database in a computing environment, comprising the steps of:
-
creating an associations cache, wherein said associations cache comprises an entry for each association in said retrieved data; and
retrieving one or more member objects of a selected one of said associations from said created associations cache.
-
Specification