| |
13 |
13 |
|
| |
14 |
14 |
|
| |
15 |
15 |
ad_proc -public util_memoize_initialized_p {} { |
| |
16 |
16 |
Return 1 if the util_memoize cache has been initialized |
| |
17 |
17 |
and is ready to be used and 0 otherwise. |
| |
18 |
18 |
|
| |
19 |
19 |
} - |
| |
20 |
20 |
|
| |
21 |
21 |
if { [catch {ns_cache set util_memoize __util_memoize_installed_p 1} error] } { |
| |
22 |
22 |
# This definition of util_memoize_initialized_p is for loading during bootstrap. |
| |
23 |
23 |
|
| |
24 |
24 |
proc util_memoize_initialized_p {} { |
| |
25 |
25 |
# |
| |
26 |
26 |
# If the cache is not yet created (or some other error is |
| |
27 |
27 |
# raised) the util_memoize cache is not available. |
| |
28 |
28 |
# |
| |
29 |
29 |
if {[catch {ns_cache set util_memoize __util_memoize_installed_p 1} error]} { |
| |
30 |
30 |
return 0 |
| |
31 |
31 |
} |
| |
32 |
32 |
# |
| |
33 |
|
# When he call above has succes, the cache is initialized, we |
| |
|
33 |
# When he call above has success, the cache is initialized, we |
| |
34 |
34 |
# can rewrite the function in an always succeeding one and |
| |
35 |
35 |
# return success as well. |
| |
36 |
36 |
# |
| |
37 |
37 |
proc ::util_memoize_initialized_p {} { |
| |
38 |
38 |
return 1 |
| |
39 |
39 |
} |
| |
40 |
40 |
return 1 |
| |
41 |
41 |
} |
| |
42 |
42 |
} else { |
| |
43 |
43 |
proc util_memoize_initialized_p {} { |
| |
44 |
44 |
# |
| |
45 |
45 |
# This definition of util_memoize_initialized_p is just for |
| |
46 |
46 |
# reloading, since at that time the cache is always |
| |
47 |
47 |
# initialized. |
| |
48 |
48 |
# |
| |
49 |
49 |
return 1 |
| |
50 |
50 |
} |
| |
51 |
51 |
} |
| |
52 |
52 |
|
| |
53 |
53 |
|