2016-09-28 03:14:10 +00:00
|
|
|
/// Extensions for <see cref="IServiceCollection" /> to add the RethinkDB cache
|
|
|
|
[<AutoOpen>]
|
|
|
|
[<System.Runtime.CompilerServices.Extension>]
|
|
|
|
module RethinkDB.DistributedCache.IServiceCollectionExtensions
|
|
|
|
|
|
|
|
open Microsoft.Extensions.Caching.Distributed
|
|
|
|
open Microsoft.Extensions.DependencyInjection
|
|
|
|
open System
|
|
|
|
|
|
|
|
type IServiceCollection with
|
|
|
|
|
2022-04-19 18:05:48 +00:00
|
|
|
member this.AddDistributedRethinkDBCache (options : Action<DistributedRethinkDBCacheOptions>) =
|
|
|
|
if isNull options then nullArg "options"
|
|
|
|
this.AddOptions () |> ignore
|
|
|
|
this.Configure options |> ignore
|
2022-04-22 01:38:51 +00:00
|
|
|
this.Add (ServiceDescriptor.Singleton<IDistributedCache, DistributedRethinkDBCache> ())
|
2022-04-19 18:05:48 +00:00
|
|
|
this
|
2016-09-28 03:14:10 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Add RethinkDB options to the services collection
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="options">An action to set the options for the cache</param>
|
|
|
|
/// <returns>The given <see cref="IServiceCollection" /> for further manipulation</returns>
|
|
|
|
[<System.Runtime.CompilerServices.Extension>]
|
|
|
|
let AddDistributedRethinkDBCache (this : IServiceCollection, options : Action<DistributedRethinkDBCacheOptions>) =
|
2022-04-19 18:05:48 +00:00
|
|
|
this.AddDistributedRethinkDBCache options
|