gorm-cache
gorm-cache copied to clipboard
gorm v2的一个即插即用的旁路缓存解决方案
我理解gorm-cache 的redis的缓存更新模式是旁路模式, gorm-cache能够保证缓存一致性吗
如加载主题Thread时,关联查询ThreadCategory,此时使用Thread.CategoryID预加载ThreadCategory,那么ThreadCategory表中的数据缓存后,在预加载是如下 ``` Preload("ThreadCategory"). ``` 是否能支持直接从缓存中读取ThreadCategory?
MaxSize
``` return cache.NewGorm2Cache(&config.CacheConfig{ CacheLevel: config.CacheLevelOnlyPrimary, CacheStorage: storage.NewGcache(gcache.New(1000)), Tables: []string{}, InvalidateWhenUpdate: true, // when you create/update/delete objects, invalidate cache CacheTTL: 5000, // 5000 ms CacheMaxItemCnt: 50, // if length of objects...