author | Claus Gittinger <cg@exept.de> |
Tue, 16 Jan 2018 22:26:58 +0100 | |
changeset 1183 | 8af078552bae |
parent 814 | 334626d1e9a0 |
permissions | -rw-r--r-- |
634 | 1 |
" |
2 |
Copyright (c) 2007-2010 Jan Vrany |
|
3 |
Copyright (c) 2009-2010 eXept Software AG |
|
4 |
||
5 |
Permission is hereby granted, free of charge, to any person |
|
6 |
obtaining a copy of this software and associated documentation |
|
7 |
files (the 'Software'), to deal in the Software without |
|
8 |
restriction, including without limitation the rights to use, |
|
9 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
10 |
copies of the Software, and to permit persons to whom the |
|
11 |
Software is furnished to do so, subject to the following |
|
12 |
conditions: |
|
13 |
||
14 |
The above copyright notice and this permission notice shall be |
|
15 |
included in all copies or substantial portions of the Software. |
|
16 |
||
17 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
18 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
19 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
20 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
21 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
22 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
23 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
24 |
OTHER DEALINGS IN THE SOFTWARE. |
|
25 |
" |
|
26 |
"{ Package: 'stx:libsvn' }" |
|
27 |
||
28 |
"{ NameSpace: SVN }" |
|
29 |
||
30 |
Object subclass:#CacheEntry |
|
31 |
instanceVariableNames:'getter value timestamp' |
|
32 |
classVariableNames:'' |
|
33 |
poolDictionaries:'' |
|
34 |
category:'SVN-Private' |
|
35 |
! |
|
36 |
||
37 |
!CacheEntry class methodsFor:'documentation'! |
|
38 |
||
39 |
copyright |
|
40 |
" |
|
41 |
Copyright (c) 2007-2010 Jan Vrany |
|
42 |
Copyright (c) 2009-2010 eXept Software AG |
|
43 |
||
44 |
Permission is hereby granted, free of charge, to any person |
|
45 |
obtaining a copy of this software and associated documentation |
|
46 |
files (the 'Software'), to deal in the Software without |
|
47 |
restriction, including without limitation the rights to use, |
|
48 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
49 |
copies of the Software, and to permit persons to whom the |
|
50 |
Software is furnished to do so, subject to the following |
|
51 |
conditions: |
|
52 |
||
53 |
The above copyright notice and this permission notice shall be |
|
54 |
included in all copies or substantial portions of the Software. |
|
55 |
||
56 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
57 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
58 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
59 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
60 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
61 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
62 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
63 |
OTHER DEALINGS IN THE SOFTWARE. |
|
64 |
||
65 |
" |
|
66 |
! ! |
|
67 |
||
68 |
!CacheEntry class methodsFor:'instance creation'! |
|
69 |
||
70 |
getter: getter |
|
71 |
||
72 |
^self new getter: getter |
|
73 |
! |
|
74 |
||
75 |
receiver: receiver selector: selector |
|
76 |
||
77 |
^self getter: |
|
78 |
(MessageSend receiver: receiver selector: selector) |
|
79 |
! |
|
80 |
||
81 |
receiver: receiver selector: selector argument: argument |
|
82 |
||
83 |
^self getter: |
|
84 |
(MessageSend receiver: receiver selector: selector argument: argument) |
|
85 |
! ! |
|
86 |
||
87 |
!CacheEntry class methodsFor:'accessing'! |
|
88 |
||
89 |
timeout |
|
90 |
||
91 |
^900"sec" |
|
92 |
! ! |
|
93 |
||
814
334626d1e9a0
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
634
diff
changeset
|
94 |
!CacheEntry class methodsFor:'others'! |
334626d1e9a0
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
634
diff
changeset
|
95 |
|
334626d1e9a0
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
634
diff
changeset
|
96 |
version_CVS |
334626d1e9a0
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
634
diff
changeset
|
97 |
^ '$Header$' |
334626d1e9a0
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
634
diff
changeset
|
98 |
! ! |
334626d1e9a0
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
634
diff
changeset
|
99 |
|
634 | 100 |
!CacheEntry methodsFor:'accessing'! |
101 |
||
102 |
getter:anObject |
|
103 |
getter := anObject. |
|
104 |
! |
|
105 |
||
106 |
timeout |
|
107 |
||
108 |
^self class timeout |
|
109 |
! |
|
110 |
||
111 |
value |
|
112 |
||
113 |
(value isNil and:[timestamp isNil or:[(Timestamp now - timestamp) > self timeout]]) |
|
114 |
ifTrue:[self computeValue]. |
|
115 |
^value |
|
116 |
||
117 |
"Modified: / 23-12-2009 / 07:54:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
118 |
! ! |
|
119 |
||
120 |
!CacheEntry methodsFor:'private'! |
|
121 |
||
122 |
computeValue |
|
123 |
||
124 |
value := getter value. |
|
125 |
timestamp := Timestamp now. |
|
126 |
! ! |
|
127 |
||
128 |
!CacheEntry class methodsFor:'documentation'! |
|
129 |
||
130 |
version |
|
131 |
^ '$Header$' |
|
132 |
! |
|
133 |
||
134 |
version_SVN |
|
814
334626d1e9a0
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
634
diff
changeset
|
135 |
^ '§Id: SVN__CacheEntry.st 363 2011-08-08 13:49:48Z vranyj1 §' |
634 | 136 |
! ! |