public CacheService(string connectionStrings) { this._options = new CacheServiceOptions() { ConnectionString = connectionStrings }; }
public IHttpActionResult Update(string key, [FromBody] string value, [FromUri] CacheServiceOptions options) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { service.Set(key, value, options); return(StatusCode(HttpStatusCode.NoContent)); } catch (NotSupportedException) { return(BadRequest()); } catch (UnauthorizedAccessException) { return(StatusCode(HttpStatusCode.Forbidden)); } catch (KeyNotFoundException) { return(NotFound()); } }
public CacheService(IOptions <CacheServiceOptions> options) { this._options = options?.Value; }