public async Task <T> Get(Guid id) { using (var l = await _lock.LockAsync()) { var f = _getFile(id); return(await _localStorageFileRepo.Get <T>(f)); } }
public async Task <bool> ValidateAge <T>(string key) where T : class, new() { var locker = XNamedLock.Get(key + "3"); using (var locked = await locker.LockAsync()) { var fullName = _getFullKey <T>(key); var f = await _getMemory <T>(key); if (f == null) { f = await _storageFileRepo.Get <XCacheItem <T> >(fullName); if (f != null && f.Item != null) { if (!_validateAge(f)) { return(false); } _updateItem(f.Item, f); var cacheSet = await _setMemory(key, f.Item, null); _updateItem(cacheSet.Item, cacheSet); } } if (f == null) { return(false); } _updateItemCacheSource(f.Item, true); return(_validateAge(f)); } }