{"modulePath":"github.com/keep-network/keep-common","version":"v1.7.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package cache\n\nPackage cache provides a time cache implementation safe for concurrent use without the need of additional locking.\n\n## Types\n\n```go\ntype TimeCache struct {\n\t// contains filtered or unexported fields\n}\n```\nTimeCache provides a time cache safe for concurrent use by multiple goroutines without additional locking or coordination.\n\n```go\nfunc NewTimeCache(timespan time.Duration) *TimeCache\n```\nNewTimeCache creates a new cache instance with provided timespan.\n\n```go\nfunc (tc *TimeCache) Add(item string) bool\n```\nAdd adds an entry to the cache. Returns \\`true\\` if entry was not present in the cache and was successfully added into it. Returns \\`false\\` if entry is already in the cache. This method is synchronized.\n\n```go\nfunc (tc *TimeCache) Has(item string) bool\n```\nHas checks presence of an entry in the cache. Returns \\`true\\` if entry is present and \\`false\\` otherwise.\n\n```go\nfunc (tc *TimeCache) Sweep()\n```\nSweep removes old entries. That is those for which caching timespan has passed.\n\n","path":"github.com/keep-network/keep-common/pkg/cache","name":"cache","synopsis":"Package cache provides a time cache implementation safe for concurrent use without the need of additional locking.","isRedistributable":true}
