From b828ca66372b42201552740375f7deb8f5e19fa2 Mon Sep 17 00:00:00 2001 From: Sergey Novikov Date: Mon, 30 Jul 2018 15:28:08 +0200 Subject: [PATCH] Update README --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index bea8eed..ae7ee7e 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,20 @@ Log: ## Caching +### Key refresh and TTL + +There are two caching parameters: + - `refresh` - the key will be fetched from the source after this interval + - `ttl` - if not used, the key will be deleted from cache + +On the first request, the key is synchronously fetched from the key server and stored in the cache. +On the next request after `refresh` interval, the key will be refreshed in the background (not affect response time). +Only 1 key refresh is executed at the same time. + +If the key is not requested during `ttl` interval, it will be removed from cache. + +## Cache implementations + Default cache is `github.com/patrickmn/go-cache` in-memory cache. You can provide your own cache implementation, see `cache.go`: