# string_local_cache **Repository Path**: excellent-projects/string_local_cache ## Basic Information - **Project Name**: string_local_cache - **Description**: 去中心化,分布式本地缓存的实现,采用WAL的方式,JAVA版客户端;详细介绍:https://blog.csdn.net/tq02h2a/article/details/77103762 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2022-12-16 - **Last Updated**: 2022-12-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README There is a sample for the distributed local cache usage. coding as following steps: 1. you need to create a loadingcache instance outside the sdk. example: LoadingCache cahceBuilder = CacheBuilder.newBuilder() .refreshAfterWrite(1 , TimeUnit.SECONDS).expireAfterWrite(3 , TimeUnit.SECONDS) .build(new CacheLoader() { @Override public String load(String key) throws Exception { return UUID.randomUUID().toString(); } }); 2. initialize the string cache. example: StringLocalCache.getInstance().initialize(cahceBuilder , new LocalCacheCallback()); Parameters: 1: loadingcache object which is created in the first step. 2: notification callback, such a flush cache event. 3. using the cache facilities. example: 1. delete the element in the cache. StringLocalCache.getInstance().del("1"); 2. set the element in the cache. StringLocalCache.getInstance().set("1" , "hello world"); 3. get the element from the cache. StringLocalCache.getInstance().get("1"); 4. notify the events to other cache nodes. StringLocalCache.getInstance().notify("event"); 4. The Agent process is responsible for replicating the data.