AliBazzi / IdentityServer4.Contrib.RedisStore

A persistence layer using Redis DB for operational data and for caching capability for Identity Server 4
https://www.nuget.org/packages/IdentityServer4.Contrib.RedisStore
MIT License
137 stars 48 forks source link

can i use redis just as cache #5

Closed liugt34 closed 6 years ago

liugt34 commented 6 years ago

i want save the config data to mysql ,and use the redis as a cache ,how can i do it? thank u

liugt34 commented 6 years ago

and i don't understand what different between the method "AddConfigurationStore" and "AddConfigurationStoreCache"

AliBazzi commented 6 years ago

Hi @liugt34

You would follow the following code as an example:

            services.AddIdentityServer()
            .AddRedisCaching(options =>
            {
                options.RedisConnectionString = "--redis connection string --";
            })
            .AddClientStoreCache<IdentityServer4.EntityFramework.Stores.ClientStore>()
            .AddResourceStoreCache<IdentityServer4.EntityFramework.Stores.ResourceStore>();

For the second question, this method is in IdentityServer4.EntityFramework package, please take a look at it's implementation here

For that, alternatively you can use it like this:

            services.AddIdentityServer()
            .AddRedisCaching(options =>
            {
                options.RedisConnectionString = "--redis connection string --";
            })
            .AddConfigurationStoreCache();
liugt34 commented 6 years ago

@AliBazzi thank you very much