1 package body ben_hash_utility as
2 /* $Header: benhashu.pkb 120.1 2005/06/12 21:04:48 mhoyes noship $ */
3 --------------------------------------------------------------------------------
4 /*
5 +==============================================================================+
6 | Copyright (c) 1997 Oracle Corporation |
7 | Redwood Shores, California, USA |
8 | All rights reserved. |
9 +==============================================================================+
10
11 Name
12 Benefit Hash Utility.
13 Purpose
14 This package is used to provide consistent hashing algorhythms for
15 caching of data strucutures within benefits.
16 History
17 Date Who Version What?
18 ---- --- ------- -----
19 01-MAY-99 GPERRY 115.0 Created.
20 06-MAY-99 mhoyes 115.1 Commented out hr_utility
21 statements.
22 09-MAY-99 mhoyes 115.2 Removed hr_utility
23 statements from all
24 procedures.
25 15-JUN-99 mhoyes 115.3 Added generic cache write
26 routines. Write_MastDet_Cache
27 and Write_BGP_Cache.
28 19-Oct-2003 nhunur 115.4 Made changes in write_mastdet_cache. Bug - 3125540.
29 12-JUN-05 mhoyes 115.7 Removed Write_MastDet_Cache
30 and Write_BGP_Cache. Defined
31 package locals as globals.
32 */
33 function get_hashed_index(p_id in number) return number is
34 --
35 begin
36 --
37 return mod(p_id,g_hash_key);
38 --
39 end get_hashed_index;
40 --
41 function get_next_hash_index(p_hash_index in number) return number is
42 --
43 begin
44 --
45 return p_hash_index+g_hash_jump;
46 --
47 end get_next_hash_index;
48 --
49 function get_hash_jump return number is
50 --
51 begin
52 --
53 return g_hash_jump;
54 --
55 end get_hash_jump;
56 --
57 function get_hash_key return number is
58 --
59 begin
60 --
61 return g_hash_key;
62 --
63 end get_hash_key;
64 --
65 -- Hopefully noone will ever use this routine as the clashing could be
66 -- increased but include it in cases where we know all data is under the limits
67 -- of 2**32
68 --
69 procedure set_hash_key(p_hash_key in number) is
70 --
71 begin
72 --
73 g_hash_key := p_hash_key;
74 --
75 end set_hash_key;
76 --
77 -- If the data is very random then it could be worth increasing the jump
78 -- value so I included the routine to do this.
79 --
80 procedure set_hash_jump(p_hash_jump in number) is
81 --
82 begin
83 --
84 g_hash_jump := p_hash_jump;
85 --
86 end set_hash_jump;
87 -----------------------------------------------------------------------
88 end ben_hash_utility;