public async Task SetAsync(string key, byte[] value, DistributedCacheEntryOptions options, CancellationToken token = default(CancellationToken))
        {
            if (key == null)
            {
                throw new ArgumentNullException(nameof(key));
            }

            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            token.ThrowIfCancellationRequested();

            var creationTime = DateTimeOffset.UtcNow;
            var expiryDate   = CassandraCacheHelper.GetAbsoluteExpiration(creationTime, options);
            var ttl          = CassandraCacheHelper.GetExpirationInSeconds(creationTime, expiryDate);

            var boundStatement = this.preparedStatements[DbOperations.Insert].Bind(key, expiryDate, value, ttl).SetConsistencyLevel(this.cacheOptions.WriteConsistencyLevel);

            await this.cacheOptions.Session.ExecuteAsync(boundStatement);
        }
        public void Set(string key, byte[] value, DistributedCacheEntryOptions options)
        {
            if (key == null)
            {
                throw new ArgumentNullException(nameof(key));
            }

            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            if (options == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            var creationTime = DateTimeOffset.UtcNow;
            var expiryDate   = CassandraCacheHelper.GetAbsoluteExpiration(creationTime, options);
            var ttl          = CassandraCacheHelper.GetExpirationInSeconds(creationTime, expiryDate);

            var boundStatement = this.preparedStatements[DbOperations.Insert].Bind(key, expiryDate, value, ttl).SetConsistencyLevel(this.cacheOptions.WriteConsistencyLevel);

            this.cacheOptions.Session.Execute(boundStatement);
        }
        public async Task <byte[]> GetAsync(string key, CancellationToken token = default)
        {
            token.ThrowIfCancellationRequested();

            var rowSet = await this.cacheOptions.Session.ExecuteAsync(this.CreateGetBoundStatement(key));

            return(CassandraCacheHelper.GetReturnValue(rowSet));
        }
        public byte[] Get(string key)
        {
            if (key == null)
            {
                throw new ArgumentNullException(nameof(key));
            }

            var boundStatement = this.preparedStatements[DbOperations.Select].Bind(key).SetConsistencyLevel(this.cacheOptions.ReadConsistencyLevel);

            var rowSet = this.cacheOptions.Session.Execute(boundStatement);

            return(CassandraCacheHelper.GetReturnValue(rowSet));
        }
        public async Task <byte[]> GetAsync(string key, CancellationToken token = default(CancellationToken))
        {
            if (key == null)
            {
                throw new ArgumentNullException(nameof(key));
            }

            token.ThrowIfCancellationRequested();

            var boundStatement = this.preparedStatements[DbOperations.Select].Bind(key).SetConsistencyLevel(this.cacheOptions.ReadConsistencyLevel);

            var rowSet = await this.cacheOptions.Session.ExecuteAsync(boundStatement);

            return(CassandraCacheHelper.GetReturnValue(rowSet));
        }
        public byte[] Get(string key)
        {
            var rowSet = this.cacheOptions.Session.Execute(this.CreateGetBoundStatement(key));

            return(CassandraCacheHelper.GetReturnValue(rowSet));
        }