Ameba-Framework-Cache-Ehcache

A useful Java framework ehcache cache!

License

License

MIT
Categories

Categories

Ehcache Data Caching
GroupId

GroupId

org.amebastack.module
ArtifactId

ArtifactId

ameba-cache-ehcache
Last Version

Last Version

0.1.9
Release Date

Release Date

Type

Type

jar
Description

Description

Ameba-Framework-Cache-Ehcache
A useful Java framework ehcache cache!
Project URL

Project URL

http://amebastack.org
Source Code Management

Source Code Management

https://github.com/intelligentcode/ameba-cache

Download ameba-cache-ehcache

How to add to project

<!-- https://jarcasting.com/artifacts/org.amebastack.module/ameba-cache-ehcache/ -->
<dependency>
    <groupId>org.amebastack.module</groupId>
    <artifactId>ameba-cache-ehcache</artifactId>
    <version>0.1.9</version>
</dependency>
// https://jarcasting.com/artifacts/org.amebastack.module/ameba-cache-ehcache/
implementation 'org.amebastack.module:ameba-cache-ehcache:0.1.9'
// https://jarcasting.com/artifacts/org.amebastack.module/ameba-cache-ehcache/
implementation ("org.amebastack.module:ameba-cache-ehcache:0.1.9")
'org.amebastack.module:ameba-cache-ehcache:jar:0.1.9'
<dependency org="org.amebastack.module" name="ameba-cache-ehcache" rev="0.1.9">
  <artifact name="ameba-cache-ehcache" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.amebastack.module', module='ameba-cache-ehcache', version='0.1.9')
)
libraryDependencies += "org.amebastack.module" % "ameba-cache-ehcache" % "0.1.9"
[org.amebastack.module/ameba-cache-ehcache "0.1.9"]

Dependencies

compile (2)

Group / Artifact Type Version
org.amebastack.module : ameba-cache-core jar 0.1.9
net.sf.ehcache : ehcache jar 2.10.3

provided (1)

Group / Artifact Type Version
org.amebastack : ameba jar 0.1.11

test (1)

Group / Artifact Type Version
junit : junit jar 4.11

Project Modules

There are no modules declared in this project.

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";
    }
}

Versions

Version
0.1.9
0.1.8
0.1.7.Alpha2
0.1.7.Alpha1
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0