1 package WF_OBJECT_CACHE as
2 /* $Header: WFOBCACS.pls 120.0.12010000.2 2008/08/09 13:41:28 sstomar ship $ */
3
4 /*-------------------+
5 | Type declarations |
6 |-------------------*/
7
8 -- Table of anydata that stores the application object to be cached
9 Type WF_OBJECTS_T is table of ANYDATA index by binary_integer;
10
11 -- Internal table that maintains the age for each of the
12 Type WF_OBJECTS_HASHVAL_T is table of number index by binary_integer;
13
14 -- Record that stores all the information related to cache and its age
15 Type WF_OBJECT_REC is record
16 (
17 Cache_Objs WF_OBJECTS_T,
18 Hash_Val WF_OBJECTS_HASHVAL_T,
19 Curr_Idx number,
20 Overflow boolean
21 );
22
23 -- Internal table of wf_objects_t to maintain a list of caches for
24 -- different objects that requires to be cached
25 Type WF_OBJECTS_TAB_T is table of WF_OBJECT_REC index by binary_integer;
26
27
28 /*------------------+
29 | Global variables |
30 +------------------*/
31
32 -- Cache maximum size
33 g_cacheMaxSize number := 50;
34
35 -- Hash range
36 g_hashBase number := 1;
37 g_hashSize number := 16777216; -- 2^24
38
39
40 /*------------+
41 | Procedures |
42 +------------*/
43
44 -- SetCacheSize
45 -- Procedure to set the maximum size of the cache.
46 procedure SetCacheSize(p_size in number);
47
48 -- CreateCache
49 -- Procedure to create a new cache to store an object type.
50 -- For example,
51 -- in BES if Events, Agents and Systems are the objects to be cached,
52 -- each of these object types would be referenced with an unique
53 -- identifier and this API called with that identifier. The identifier
54 -- would be used to store and retrieve that object type in cache.
55 procedure CreateCache(p_cache_index in varchar2);
56
57 -- IsCacheCreated
58 -- Function that checks if cache is already created for a given cache index
59 -- If cache is already created, it need not be created again.
60 function IsCacheCreated(p_cache_index in number)
61 return boolean;
62
63 -- SetObject
64 -- This procedure helps to store an object of type ANYDATA within a cache
65 -- that was previously created with CreateCache. The object is stored
66 -- within a PLSQL table under a subscript that is a hash value generated
67 -- from the object key.
68 -- For example,
69 -- If an event object is to be cached whose name is oracle.apps.vj.test,
70 -- a hash value is generated for event name oracle.apps.vj.test and the object
71 -- is stored under that location within the PLSQL table.
72 procedure SetObject(p_cache_index in number,
73 p_object in anydata,
74 p_object_key in varchar2);
75
76 -- GetObject
77 -- This procedure returns ANYDATA object from a given cache for a given
78 -- object cache.
79 function GetObject(p_cache_index in number,
80 p_object_key in varchar2)
81 return anyData;
82
83 -- GetAllObjects
84 -- This procedure returns all the ANYDATA objects cached under a given cache
85 function GetAllObjects(p_cache_index in number)
86 return wf_objects_t;
87
88 -- Clear
89 -- This procedure deletes all the caches from memory. This is done in case
90 -- cache is found to be invalid.
91 procedure Clear(p_cache_index in varchar2 default null);
92
93 end WF_OBJECT_CACHE;