7626:7f643d41464e | 7628:f904d0eef264 |
---|---|
23 """ | 23 """ |
24 Constructor | 24 Constructor |
25 | 25 |
26 @param size maximum number of entries that may be stored in the cache | 26 @param size maximum number of entries that may be stored in the cache |
27 @type int | 27 @type int |
28 """ | 28 @exception ValueError raised to indicate an illegal 'size' parameter |
29 assert size >= 0 | 29 """ |
30 if size < 0: | |
31 raise ValueError("'size' parameter must be positive.") | |
30 | 32 |
31 self.__size = size | 33 self.__size = size |
32 | 34 |
33 # internal objects | 35 # internal objects |
34 self.__keyList = [] | 36 self.__keyList = [] |
81 | 83 |
82 @param newSize maximum number of entries that may be stored in the | 84 @param newSize maximum number of entries that may be stored in the |
83 cache | 85 cache |
84 @type int | 86 @type int |
85 """ | 87 """ |
86 assert newSize >= 0 | 88 if newSize >= 0: |
87 | 89 self.__size = newSize |
88 self.__size = newSize | 90 self.__adjustToSize() |
89 self.__adjustToSize() | |
90 | 91 |
91 def getMaximumCacheTime(self): | 92 def getMaximumCacheTime(self): |
92 """ | 93 """ |
93 Public method to get the maximum time entries may exist in the cache. | 94 Public method to get the maximum time entries may exist in the cache. |
94 | 95 |