private byte[] GetAndRefresh(string key, bool getData) { if (key == null) { throw new ArgumentNullException(nameof(key)); } // This also resets the LRU status as desired. // TODO: Can this be done in one operation on the server side? Probably, the trick would just be the DateTimeOffset math. string[] results; if (getData) { results = _redisClient.HashMGet(key, AbsoluteExpirationKey, SlidingExpirationKey, DataKey); } else { results = _redisClient.HashMGet(key, AbsoluteExpirationKey, SlidingExpirationKey); } // TODO: Error handling if (results.Length >= 2) { MapMetadata(results, out DateTimeOffset? absExpr, out TimeSpan? sldExpr); Refresh(key, absExpr, sldExpr); } if (results.Length >= 3 && !string.IsNullOrEmpty(results[2])) { return(Encoding.UTF8.GetBytes(results[2])); } return(null); }