dtcache

Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/

Лицензия

Лицензия

Группа

Группа

org.naike
Идентификатор

Идентификатор

dtcache
Последняя версия

Последняя версия

1.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

dtcache
Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/
Ссылка на сайт

Ссылка на сайт

http://maven.apache.org
Система контроля версий

Система контроля версий

https://github.com/sxwailyc/dtcache

Скачать dtcache

Как подключить последнюю версию

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

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
redis.clients : jedis jar 2.8.0
commons-logging : commons-logging jar 1.2

Модули Проекта

Данный проект не имеет модулей.

dtcache, a local cache support data sync for distributed application


config the cache(only need call once)

    	CacheItemListener cacheItemListener = new CacheItemListenerRedisImpl() {

			@Override
			public Jedis getRedis() {
				return redis.getResource();
			}

			@Override
			public void closeRedis(Jedis jedis) {
				redis.returnResource(jedis);
			}
		};

		CacheConfig config = new CacheConfig.Builder().cacheItemListener(cacheItemListener).build();
        LocalCache.start(config);

example

write

Cache cache = new LocalCache();
User user = new User();
user.setUserId("userId");
user.setUsername("username");
cache.put(user.getUserId(), user);

read

Cache cache = new LocalCache();
User user = cache.get("userId", User.class);

delete

Cache cache = new LocalCache();
cache.delete(User.class, "userId);

Версии библиотеки

Версия
1.0