SkillAgentSearch skills...

GCache

一个轻量级,高性能的缓存构架,以android缓存而设计为初衷,也可以应用于一般的Java项目中。

Install / Use

/learn @tonybase/GCache
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

GCache

一个轻量级,高性能的缓存构架,以android缓存而设计为初衷,也可以应用于一般的Java项目中。

======

DiskWithMemoryCache:

GCache cache = Builders.newBuilder()
			.withTranscoder(new StringTranscoder())
			.withCacheRootDirectory(new File("diskCache"))
			.maxDiskUsageBytes(10000)
			.maxMemoryUsageBytes(1000)
			.defaultCacheTime(50)
			.build();
			

MemoryCache:

GCache cache = Builders.newBuilderForMemory()
			.withTranscoder(new StringTranscoder())
			.maxMemoryUsageBytes(10000)
			.defaultCacheTime(20)
			.build();
			

DiskBasedCache:

GCache cache = Builders.newBuilderForDisk()
			.withTranscoder(new StringTranscoder())
			.withCacheRootDirectory(new File("diskCache"))
			.maxDiskUsageBytes(1000)
			.defaultCacheTime(50)
			.build();			
			

cache.put(K, V); //use defaultCacheTime
cache.put(K, V, TTL);
cache.get(K);

Related Skills

View on GitHub
GitHub Stars14
CategoryDevelopment
Updated2y ago
Forks7

Languages

Java

Security Score

75/100

Audited on Aug 22, 2023

No findings