Method and apparatus for managing relational data in an object cache
First Claim
1. A method for coupling a plurality of object instances, each object instance in said plurality comprising a unique object ID, attributes, and relationships in an object-oriented application to a structured database, said structured database comprising foreign keys, primary keys, tables, rows and columns, said object-oriented application being executed in a digital computing system comprising a processor, said method comprising the steps of:
- executing instructions on said processor to generate a request in the object-oriented application, said request being selected from the group consisting of a request for information about an object instance in said object-oriented application and a request to navigate a relationship between object instances of said object-oriented application;
executing instructions on said processor to determine whether said request can be resolved with reference to an object cache comprising object instances of said object-oriented application, and without reference to said structured database;
if said request can be resolved with reference to said object cache and without reference to said structured database, executing instructions on said processor to resolve said request by referring to said object cache; and
if said request cannot be resolved with reference to said object cache and without reference to said structured database,then if said request is a request for information about an object instance in said object-oriented application executing instructions on said processor to resolve said request by querying said structured database to obtain information from said foreign keys, primary keys, tables, rows and columns required to construct an object instance, modifying said object cache according to said information, and referring to said object instance contained in said modified object cache;
if said request is a request to navigate a relationship between object instances of said object-oriented application, executing instructions on said processor to construct a relationship pointer in said object cache between said object instances comprising a first object instance and a related second object instance byquerying said structured database to extract relationship information represented by at least one key and information relating to said at least one key, said key comprising primary and foreign keys, from said first object instance representing said relationship;
using said key and said related information to look up said related second object instance in said object cache; and
constructing a relationship pointer from said first object instance to said second related object instance, said relationship pointer being traversable by said object oriented application.
6 Assignments
0 Petitions
Accused Products
Abstract
In an object-oriented application being executed in a digital computing system comprising a processor, a method and apparatus are provided for managing information retrieved from a structured database, such as a relational database, wherein the processor is used to construct a plurality of object instances, each of these object instances having its own unique object ID that provides a mapping between the object instance and at least one row in the structured database. The processor is used to construct a single cohesive data structure, called an object cache, that comprises all the object instances and that represents information retrieved from the structured database in a form suitable for use by one or more object-oriented applications. A mechanism for managing the object cache is provided that has these three properties: First, through a technique called key swizzling, it uses explicit relationship pointers between object instances in the object cache to reduce the volume of queries to the structured database. Second, it ensures that only one copy of an object instance is in the cache at any given time, even if several different queries return the same information from the database. Third, the mechanism guarantees the integrity of data in the cache by locking data appropriately in the structured database during a database transaction, flushing cache data at the end of each transaction, and transparently re-reading the data and reacquiring the appropriate locks for an object instance whose data has been flushed.
-
Citations
11 Claims
-
1. A method for coupling a plurality of object instances, each object instance in said plurality comprising a unique object ID, attributes, and relationships in an object-oriented application to a structured database, said structured database comprising foreign keys, primary keys, tables, rows and columns, said object-oriented application being executed in a digital computing system comprising a processor, said method comprising the steps of:
-
executing instructions on said processor to generate a request in the object-oriented application, said request being selected from the group consisting of a request for information about an object instance in said object-oriented application and a request to navigate a relationship between object instances of said object-oriented application; executing instructions on said processor to determine whether said request can be resolved with reference to an object cache comprising object instances of said object-oriented application, and without reference to said structured database; if said request can be resolved with reference to said object cache and without reference to said structured database, executing instructions on said processor to resolve said request by referring to said object cache; and if said request cannot be resolved with reference to said object cache and without reference to said structured database, then if said request is a request for information about an object instance in said object-oriented application executing instructions on said processor to resolve said request by querying said structured database to obtain information from said foreign keys, primary keys, tables, rows and columns required to construct an object instance, modifying said object cache according to said information, and referring to said object instance contained in said modified object cache; if said request is a request to navigate a relationship between object instances of said object-oriented application, executing instructions on said processor to construct a relationship pointer in said object cache between said object instances comprising a first object instance and a related second object instance by querying said structured database to extract relationship information represented by at least one key and information relating to said at least one key, said key comprising primary and foreign keys, from said first object instance representing said relationship; using said key and said related information to look up said related second object instance in said object cache; and constructing a relationship pointer from said first object instance to said second related object instance, said relationship pointer being traversable by said object oriented application.
-
-
2. In an object-oriented application being executed in a digital computing system comprising a processor, a method for managing information, said information comprising a plurality of object instances, each object instance in said plurality comprising a unique object ID, attributes, and relationships retrieved from a structured database, said method comprising the steps of:
-
executing instructions on said processor to construct a plurality of object instances based on information retrieved from queries to said structured database, said structured database comprising foreign keys, primary keys, tables, rows and columns; executing instructions on said processor to construct a unique object ID for each of said object instances, said object ID comprising information extracted from said keys associated with the object instance, in order to provide a mapping between said object instance and at least one row in said structured database; executing instructions on said processor to construct a single cohesive object cache comprising all object instances of said plurality of object instances and at least one relationship between two objects; executing instructions on said processor to construct a cache dictionary, said cache dictionary containing said object ID and location of every object instance in said object cache; and executing instructions on said processor to resolve navigational requests from said object-oriented application by following bi-directional pointers between related object instances in said object cache.
-
-
3. In an object-oriented application being executed in a digital computing system comprising a processor, a method for managing information, said information comprising a plurality of object instances, each object instance in said plurality comprising a unique object ID, attributes, and relationships retrieved from a structured database, said method comprising the steps of:
-
executing instructions on said processor to construct a plurality of object instances based on information retrieved from queries to said structured database, said structured database comprising foreign keys, primary keys, tables, rows and columns; executing instructions on said processor to construct a unique object ID for each of said object instances, said object ID comprising information extracted from said keys associated with the object instance, in order to provide a mapping between said object instance and at least one row in said structured database; executing instructions on said processor to construct a single cohesive object cache comprising all object instances of said plurality of object instances and at least one relationship between two objects; executing instructions on said processor to construct a cache dictionary, said cache dictionary containing said object ID and location of every object instance in said object cache; and executing instructions on said processor to resolve a navigational request from said object-oriented application by following a relationship pointer associated with a first object instance to at least one related object instance in said object cache. - View Dependent Claims (4, 5)
-
-
6. In an object-oriented application being executed in a digital computing system comprising a processor, a method for managing information, said information comprising a plurality of object instances, each object instance in said plurality comprising a unique object ID, attributes, and relationships retrieved from a structured database, said method comprising the steps of:
-
executing instructions on said processor to construct a plurality of object instances based on information retrieved from queries to said structured database, said structured database comprising foreign keys, primary keys, tables, rows and columns; executing instructions on said processor to construct a unique object ID for each of said object instances, said object ID comprising information extracted from said keys associated with the object instance, in order to provide a mapping between said object instance and at least one row in said structured database; executing instructions on said processor to construct a single cohesive object cache comprising all object instances of said plurality of object instances and at least one relationship between two objects; executing instructions on said processor to construct a cache dictionary, said cache dictionary containing said object ID and location of every object instance in said object cache; and executing instructions on said processor to resolve a navigational request to navigate a relationship for a first object instance from said object-oriented application by executing instructions on said processor to extract at least one key, and information relating to said at least one key, said key comprising primary and foreign keys, from said first object instance to construct an object ID for a related object instance, to perform a lookup in said cache dictionary of a reference to said related object instance in said object cache based on said object ID for said related object instance, to construct a relationship pointer from said first object instance to said related object instance, and to follow said relationship pointer thus constructed.
-
-
7. In an object-oriented application being executed in a digital computing system comprising a processor, a method for managing information, said information comprising a plurality of object instances, each object instance in said plurality comprising a unique object ID, attributes, and relationships retrieved from a structured database, said method comprising the steps of:
-
executing instructions on said processor to construct a plurality of object instances based on information retrieved from queries to said structured database, said structured database comprising foreign keys, primary keys, tables, rows and columns; executing instructions on said processor to construct a unique object ID for each of said object instances, said object ID comprising information extracted from said keys associated with the object instance, in order to provide a mapping between said object instance and at least one row in said structured database; executing instructions on said processor to construct a single cohesive object cache comprising all object instances of said plurality of object instances and at least one relationship between two objects; executing instructions on said processor to construct a cache dictionary, said cache dictionary containing said object ID and location of every object instance in said object cache; and executing instructions on said processor to resolve a request from said object-oriented application to navigate a relationship involving a first object instance in said object cache, said relationship being selected from the group consisting of a one-to-one relationship, a one-to-many relationship, and a many-to-many relationship, said first object instance having a relationship pointer corresponding to said relationship, said request being resolved by said processor by following said relationship pointer. - View Dependent Claims (8, 9, 10)
-
-
11. In an object-oriented application being executed in a digital computing system comprising a processor, a method for managing information, said information comprising a plurality of object instances, each object instance in said plurality comprising a unique object ID, attributes, and relationships retrieved from a structured database, said method comprising the steps of:
-
executing instructions on said processor to construct a plurality of object instances based on information retrieved from queries to said structured database, said structured database comprising foreign keys, primary keys, tables, rows and columns; executing instructions on said processor to construct a unique object ID for each of said object instances, said object ID comprising information extracted from said keys associated with the object instance, in order to provide a mapping between said object instance and at least one row in said structured database; executing instructions on said processor to construct a single cohesive object cache comprising all object instances of said plurality of object instances and at least one relationship between two objects; executing instructions on said processor to construct a cache dictionary, said cache dictionary containing said object ID and location of every object instance in said object cache; executing instructions on said processor to generate a request in said object-oriented application; executing instructions on said processor to determine whether said request can be resolved with reference to said object cache and without reference to said structured database by executing instructions on said processor to follow a relationship pointer between an object instance in said object cache and at least one related object instance; if said request can be resolved with reference to said object cache and without reference to said structured database, executing instructions on said processor to resolve said request by referring to said object cache; and if said request cannot be resolved with reference to said object cache and without reference to said structured database, executing instructions on said processor to resolve said request by querying said structured database to obtain information required to construct an object instance and a relationship pointer from said object instance to a related object instance, modifying said object cache according to said information, and referring to said object instance in said modified object cache.
-
Specification