Giter Club home page Giter Club logo

cache-burger's Introduction

Cache-Burger

  • Cache manager to read/write local and remote cache distributed automatically.
  • You can use a cache more efficient than local cache, more high performance than remote cache.
  • Asynchronous and non blocking update cache data between local and remote cache by RxJava.
  • Support to query cache hit rate

Bean properties

    <bean name="modelCacheDefinition" class="com.midday.burger.cacheburger.model.BurgerCacheDefinition">
    	<!-- name of cache -->
        <property name="name" value="example" />
        <!-- cache class model -->
        <property name="cacheModelClass" value="com.midday.project.SomeClass" />
        <!-- LocalCache (EhCache) Max Element -->
        <property name="localCacheElementMaxCount" value="100000" />
        <!-- LocalCache (EhCache) Expire second -->
        <property name="localCacheTime" value="20" />
        <!-- RemoteCache (Couchbase) Server adddress -->
        <property name="couchbaseNode" value="http://couchbase-server.company.com:8091" />
        <!-- RemoteCache (Couchbase) Bucket name -->
        <property name="couchbaseBucket" value="bucket" />
        <!-- RemoteCache (Couchbase) Bucket password -->
        <property name="couchbasePassword" value="password" />
        <!-- RemoteCache (Couchbase) TTL -->
        <property name="remoteCacheTime" value="300" />
    </bean>

    <bean name="modelDataCache" class="com.midday.burger.cacheburger.BurgerCacheManager">
        <property name="cacheDefinition" ref="modelCacheDefinition" />
    	<!-- TTL time for asynchronos and non blocking update of remote cache.-->
        <!-- If 0, caches are updated with blocking method -->
        <property name="remoteCacheAsyncTime" value="60" />
        <property name="asyncThreadCount" value="1" />
    </bean>

Quick and easy example

  • Get and update if expired or too long
modelDataCache.get(dataNo, data -> getData(data));
modelDataCache.gets(dataNo, dataList -> getData(new ArrayList<>(dataList)));
  • Update to local and remote cache automatically
modelDataCache.updateCache(dataNo, data);

cache-burger's People

Contributors

midday12 avatar

Watchers

sewok.kwon avatar  avatar

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.