Giter Club home page Giter Club logo

ameba-cache's Introduction

ameba-cache

ameba缓存模块

使用

添加引用

ehcache 缓存引擎

<dependency>
    <groupId>org.amebastack.module</groupId>
    <artifactId>ameba-cache-ehcache</artifactId>
    <version>0.1.0</version>
</dependency>

memchached 缓存引擎

<dependency>
    <groupId>org.amebastack.module</groupId>
    <artifactId>ameba-cache-memcached</artifactId>
    <version>0.1.0</version>
</dependency>

配置

memcached 配置

必须配置项
cache.memcached.server.{serverName}=host:port

e.g.

cache.memcached.server.localhost=127.0.0.1:11211
可选配置项
# 默认为AMEBA_CACHE
cache.name=String
cache.memcached.blocking=Boolean
cache.memcached.selectorRunnersCount=Integer
cache.memcached.ioStrategy=ClassString
cache.memcached.transport=ClassString
cache.memcached.workerThreadPool=ClassString
cache.memcached.allowDisposableConnection=Boolean
cache.memcached.borrowValidation=Boolean
cache.memcached.failover=Boolean
cache.memcached.connectTimeoutInMillis=Long
cache.memcached.healthMonitorIntervalInSecs=Long
cache.memcached.keepAliveTimeoutInSecs=Long
cache.memcached.maxConnectionPerServer=Integer
cache.memcached.minConnectionPerServer=Integer
cache.memcached.preferRemoteConfig=Boolean
cache.memcached.responseTimeoutInMillis=Long
cache.memcached.returnValidation=Boolean
cache.memcached.writeTimeoutInMillis=Long

#true 才会开启ZooKeeper支持,需要添加zookeeper引用
cache.memcached.zk.enabled=Boolean
ZooKeeper 必选配置
# 在ZooKeeper注册的名称
cache.memcached.zk.name=String
# e.g. 127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002
cache.memcached.zk.servers=String
ZooKeeper 可选配置
cache.memcached.zk.rootPath=String
cache.memcached.zk.connectTimeoutInMillis=Integer
cache.memcached.zk.sessionTimeoutInMillis=Integer
cache.memcached.zk.commitDelayTimeInSecs=Integer

对父资源进行标记

  1. 对于基础资源缓存,缓存将因用于所有子资源
  2. 子资缓存配置会替换父资源缓存配置
@Path("cached")
@Cached
public class CachedResource {
    @GET
    @Path("1")
    public String cache1() {
        return "cache1";
    }
    
    @GET
    @Path("2")
    @Cached("10s")
    public String cache2() {
        return "cache1";
    }
}

对子源进行标记

  1. 直接在子资源标记,只应用于该URI上
@Path("cache")
public class CacheResource {
    @GET
    @Path("1")
    @Cached("10s")
    public String cache() {
        return "cache";
    }
}

ameba-cache's People

Contributors

icode avatar

Stargazers

 avatar  avatar

Watchers

 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.