-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCached.p
More file actions
59 lines (36 loc) · 1021 Bytes
/
Cached.p
File metadata and controls
59 lines (36 loc) · 1021 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
############################################################
# $Id: Cached.p,v 1.3 2011-03-25 09:02:32 misha Exp $
@CLASS
Als/Utils/Cached
@create[hParams]
$hParams[^hash::create[$hParams]]
$hData[^hash::create[]]
$bDisableCaching($hParams.bDisableCaching)
@exec[sKey;jBody;hParams]
$hParams[^hash::create[$hParams]]
^if($bDisableCaching || $hParams.bSkipCaching || !^hData.contains[$sKey]){
$hData.[$sKey][dummy] ^rem{ *** required if jBoby execution triggers an exception. todo@ need an option for switching this feature on and off *** }
$hData.[$sKey][^self._process[$sKey]{$jBody}[$hParams]]
}
$result[$hData.$sKey]
@get[sKey]
$result[$hData.$sKey]
@put[sKey;uValue]
$hData.[$sKey][$uValue]
$result[]
@delete[sKey]
^hData.delete[$sKey]
$result[]
@contains[sKey]
$result(^hData.contains[$sKey])
@add[hValue]
^hData.add[$hValue]
$result[]
@hash[]
$result[$hData]
@disableCaching[]
$bDisableCaching(true)
@enableCaching[]
$bDisableCaching(false)
@_process[sKey;jBody;hParams]
$result[$jBody]