Giter Site home page Giter Site logo

Comments (4)

alastairtree avatar alastairtree commented on May 30, 2024

Sorry, docs not up to date yet. Try this to chage the default to 3m.

  IAppCache cache = new CachingService(CachingService.DefaultCacheProvider);
  cache.DefaultCachePolicy.DefaultCacheDurationSeconds = 60 * 3; //3mins

from lazycache.

johnhamm avatar johnhamm commented on May 30, 2024

Configuring this setting in Asp.net core would look like this:

services.AddLazyCache(serviceProvider => {
                var cache = new CachingService(CachingService.DefaultCacheProvider);
                cache.DefaultCachePolicy.DefaultCacheDurationSeconds = cachingSettings.DefaultDefaultCacheDurationSeconds;
                return cache;
            });

from lazycache.

LiamKarlMitchell avatar LiamKarlMitchell commented on May 30, 2024

https://github.com/alastairtree/LazyCache/wiki/API-documentation-(v-2.x)#configuring-the-default-cache-duration-of-20-minutes
Wiki needs update also..

var cache = new CachingService() { DefaultCachePolicy.DefaultCacheDurationSeconds = 60 * 3; };

How to set sliding as default?

from lazycache.

rozbo avatar rozbo commented on May 30, 2024

https://github.com/alastairtree/LazyCache/wiki/API-documentation-(v-2.x)#configuring-the-default-cache-duration-of-20-minutes
Wiki needs update also..

var cache = new CachingService() { DefaultCachePolicy.DefaultCacheDurationSeconds = 60 * 3; };

How to set sliding as default?

default is 1200s

namespace LazyCache
{
  public class CacheDefaults
  {
    public virtual int DefaultCacheDurationSeconds { get; set; } = 1200;

    internal MemoryCacheEntryOptions BuildOptions() => new MemoryCacheEntryOptions()
    {
      AbsoluteExpiration = new DateTimeOffset?(DateTimeOffset.UtcNow.AddSeconds((double) this.DefaultCacheDurationSeconds))
    };
  }
}

from lazycache.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.