Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AddDistributedSqlServerCache Expiration not being set #3625

Closed
MartinDawson opened this issue Oct 14, 2018 · 1 comment
Closed

AddDistributedSqlServerCache Expiration not being set #3625

MartinDawson opened this issue Oct 14, 2018 · 1 comment

Comments

@MartinDawson
Copy link

MartinDawson commented Oct 14, 2018

The SlidingExpirationInSeconds is never been set. It's always 1200 seconds no matter what I do.

            services.AddMemoryCache();
            services.AddDistributedSqlServerCache(options =>
            {
                options.ConnectionString = Env.GetString("DEFAULT_CONNECTION");
                options.SchemaName = "dbo";
                options.TableName = "Cache";
                options.DefaultSlidingExpiration = TimeSpan.FromDays(1);
            });
            services.AddSession();

            app.UseSession(new SessionOptions {
                Cookie = new CookieBuilder
                {
                    Name = ".AspNetCore.Session",
                    SameSite = SameSiteMode.None,
                }
            });

I set it by doing this:

            Session.SetString("OAuthToken", token.AccessToken);

image

@Tratcher
Copy link
Member

Tratcher commented Oct 14, 2018

You want to set the Session IdleTimeout instead, it overrides the default sliding expiration.

@dotnet dotnet locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants