2018-project-roaster: github.com/LuleaUniversityOfTechnology/2018-project-roaster/analyze/cache Index | Files

package cache

import "github.com/LuleaUniversityOfTechnology/2018-project-roaster/analyze/cache"

Package cache implements a simple thread-safe cache with expiration.

Index

Package Files

cache.go

type Cache Uses

type Cache struct {
    // contains filtered or unexported fields
}

Cache is a thread-safe cache that holds objects with expiration.

func New Uses

func New(expiration, cleanupInterval time.Duration) (c *Cache)

New returns a new cache with a clean up routine.

func (*Cache) Get Uses

func (c *Cache) Get(key string) (object interface{}, ok bool)

Get returns a object from the cache using the provided key. The key is hashed using a hash function before lookup.

func (*Cache) Set Uses

func (c *Cache) Set(key string, object interface{})

Set adds the object to the cache using the provided key. The key is hashed with a hash function before insertion.

type Item Uses

type Item struct {
    // contains filtered or unexported fields
}

Item represents a saved object in the cache. The object has a TTL that the clean up routine uses to check if the object has expired.

Package cache imports 4 packages (graph) and is imported by 2 packages. Updated 2019-01-14. Refresh now. Tools for package owners.