29. 惡搞 Active Cache
Active Cache
資料過期前(時),主動重抓資料
現有的 Library
guava CacheLoader
BUT legacy code 太難改,
決定以不改 code 為目標
30. 惡搞 Active Cache
使用 AOP 插入 Advice
讓 business logic 支援 Active Cache
1. 將 method call 轉成 cache key
2. 註冊 method call 至 cache refresh scheduler
31. active cache
惡搞 Active Cache
request business logic
KEYCached Refresh Scheduler
business logic
method call to cache key
register key + method call to scheduler
32. active cache
惡搞 Active Cache
request business logic
Cached Refresh Scheduler
cache storage
auto refresh
business logic
使用者看到的
business logic
真正的
business logic