springcache

A simple implement of spring cache by redis or memcached.

License

License

GroupId

GroupId

com.sohu.cache
ArtifactId

ArtifactId

springcache
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

springcache
A simple implement of spring cache by redis or memcached.
Project URL

Project URL

https://github.com/yezigl/springcache

Download springcache

How to add to project

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

Dependencies

compile (6)

Group / Artifact Type Version
org.slf4j : slf4j-api jar 1.7.2
org.springframework : spring-core jar 3.2.1.RELEASE
org.springframework : spring-context jar 3.2.1.RELEASE
com.alibaba : fastjson jar 1.1.24
redis.clients : jedis Optional jar 2.1.0
com.googlecode.xmemcached : xmemcached Optional jar 1.3.9

runtime (2)

Group / Artifact Type Version
org.slf4j : jcl-over-slf4j jar 1.7.2
ch.qos.logback : logback-classic jar 1.0.9

test (2)

Group / Artifact Type Version
junit : junit jar 4.10
org.springframework : spring-test jar 3.2.1.RELEASE

Project Modules

There are no modules declared in this project.

springcache

A simple implement of spring cache by redis or memcached.

Usage:

<cache:annotation-driven cache-manager="springcacheManager" />

<!-- for redis -->
<bean id="springcacheManager" class="com.sohu.cache.springcache.jedis.JedisCacheManager">
    <property name="namedClients">
        <map>
            <entry key="default" value="127.0.0.1:6379 127.0.0.1:6380" /><!-- separate by space -->
        </map>
    </property>
    <property name="cacheStoreJedisHashRouter">
        <bean class="com.sohu.cache.springcache.CacheStoreJedisHashRouter" />
    </property>
    <property name="serializer">
        <bean class="com.sohu.cache.common.JsonSerializer" />
    </property>
    <property name="expires" value="604800" /><!--7 days, second -->
    <property name="maxActive" value="100" />
    <property name="testOnBorrow" value="true" />
</bean>

<!-- for memcached -->
<bean id="springcacheManager" class="com.sohu.cache.springcache.xmemcached.XmemCacheManager">
    <property name="namedClients">
        <map>
            <entry key="default" value="127.0.0.1:11211 127.0.0.1:11212" /><!-- separate by space -->
        </map>
    </property>
    <property name="serializer">
        <bean class="com.sohu.cache.common.JsonSerializer" />
    </property>
    <property name="expires" value="604800" /><!--7 days, second -->
    <property name="maxConn" value="8" />
    <property name="consistent" value="true" /><!-- nginx consitent hash -->
</bean>

Dependency:

<!-- redis -->
<dependency>
    <groupId>redis.clients</groupId>
    <artifactId>jedis</artifactId>
    <version>${jedis.version}</version>
</dependency>

<!-- memcached -->
<dependency>
    <groupId>com.googlecode.xmemcached</groupId>
    <artifactId>xmemcached</artifactId>
    <version>${xmemcached.version}</version>
</dependency>

Versions

Version
1.1.0