(func: Function | string, keyData: any, raiseException = true)
| 155 | } |
| 156 | |
| 157 | static get(func: Function | string, keyData: any, raiseException = true): any { |
| 158 | if (Array.isArray(keyData)) { |
| 159 | return Cache.getItems(func, keyData); |
| 160 | } |
| 161 | |
| 162 | _createCacheDirectoryIfNotExists(func); |
| 163 | const path = _getCachePath(func, keyData); |
| 164 | if (_has(path)) { |
| 165 | try { |
| 166 | return _get(path); |
| 167 | } catch (error) { |
| 168 | return null; |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | if (raiseException) { |
| 173 | throw new CacheMissException(path); |
| 174 | } |
| 175 | return null; |
| 176 | } |
| 177 | |
| 178 | static getItems(func: Function | string, items?: any[]): any[] { |
| 179 | if (typeof items === 'string') { |
no test coverage detected