Skip to content

ThierrySquirrel/container-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#container-cache

cache

中文

Support function:

  • Cache
  • ClearCache

Cache:

Provide Level 1 JVM Cache Databases and Redis should store tokens instead of caches

ClearCache:

Provide Clear Cache Annotation

Quick Start

<!--Adding dependencies to pom. XML-->
<dependency>
    <groupId>io.github.thierrysquirrel</groupId>
    <artifactId>container-cache-loading</artifactId>
    <version>1.0.0.0-RELEASE</version>
</dependency>

configuration file

## Java.ClassLoading
Class.forName=io.github.thierrysquirrel.cache.loading.CacheLoading
Method.setInitialCacheCapacity.int=4096
Method.setMaximumCacheCapacity.int=8192
Method.setExpirationTime.int=600
@ScannerPackage(packageName = "com.hello.world.web.cache")
public class CaffeineRegistrationImpl implements InterfaceManualRegistration {

   @Override
   public void scannerAll(List<Class<?>> scannerClassList, Map<Class<?>, Object> registrationMap) {
       CaffeineRegistration.caffeineRegistrationScannerAll(scannerClassList, registrationMap);
   }
}

Cache

ClearCache

@JvmCache
public class HelloCache {

   @Cache
   public String cache(@CacheParameter int a) {
       System.out.println("SQL");
       return "JVM cache";
   }

   @Cache
   public String cache(@CacheParameter int a, int b, @CacheParameter String c) {
       System.out.println("CacheParameter SQL");
       return "CacheParameter Cache";
   }

   @ClearCache
   public String clearCache(@CacheParameter int a) {
       System.out.println("clear");
       return "clearCache";
   }
}

WEB

@Http("/web")
public class HttpDemo {

   @Set
   private HelloCache helloCache;

   @Get("/cache")
   public String cache() {
       return helloCache.cache(1);
   }

   @Get("/clear")
   public String clear() {
       return helloCache.clearCache(1);
   }
}

About

container-cache

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

 
 
 

Contributors