Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I hope to provide a method: get the value but not update the expiration time #57

Open
sirodeneko opened this issue Oct 28, 2021 · 5 comments

Comments

@sirodeneko
Copy link

I hope to provide a method: get the value but not update the expiration time

@sirodeneko
Copy link
Author

If you are busy, I can do it。

@HansenH
Copy link

HansenH commented Dec 9, 2021

Same. go-cache can get a value without updating the exp time, but it cannot be set to update after each access. I need the two features both.

@dreamblack86
Copy link

dreamblack86 commented Dec 29, 2021

Hello all. I also need the function that the value is forced to be deleted after timeout.

func (table *CacheTable) Add(key interface{}, lifeSpan time.Duration, data interface{}) *CacheItem {
func (table *CacheTable) AddWithTTL(key interface{}, ttl time.Duration, data interface{}) *CacheItem {

@dreamblack86
Copy link

Ok, for the first time we can flush the complete cache. => as a work-a-round

var internalCache *cache2go.CacheTable

func init() {
	internalCache = cache2go.Cache("internalCache")
	go func() {
		for {
			time.Sleep(1 * time.Minute)
			internalCache.Flush()
		}
	}()
}

@muesli
Copy link
Owner

muesli commented Dec 30, 2021

@sirodeneko @dreamblack86 Happy to review a PR for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants