godropbox: github.com/dropbox/godropbox/container/concurrent Index | Files | Directories

package concurrent

import "github.com/dropbox/godropbox/container/concurrent"

Provides a few useful thread-safe data-structures

Index

Package Files

doc.go lrucache.go map.go

type CacheResult Uses

type CacheResult struct {
    // Result value
    V   interface{}
    // Indicates whether it exists in the cache or not
    Found bool
}

Represents value in cache and whether it exists or not

type LRUCache Uses

type LRUCache interface {
    // Retrieves multiple items from the cache
    GetMultiple(keys []string) []CacheResult
    // Retrieves a single item from the cache and whether it exists
    Get(key string) (v interface{}, found bool)
    // Sets a single item in the cache
    Set(key string, v interface{})
    // Sets multiple items in the cache
    SetMultiple(keyValues map[string]interface{})
    // Deletes one or more keys
    Delete(keys ...string)
    // Clears the cache
    Clear()
    // Retrieves the maximum size of the cache
    MaxSize() int
}

A thread-safe version of LRUCache

func NewLRUCache Uses

func NewLRUCache(size int) LRUCache

type Map Uses

type Map interface {
    // Retrieves an item from the map an indicates whether it exists or not
    Get(key interface{}) (interface{}, bool)
    // Sets the value for a particular item in the map
    Set(key interface{}, value interface{})
    // Deletes an item from the map with the provided key
    Delete(key interface{})
    // Retrieves the size of the map
    Len() int
}

A thread-safe version of map

func NewMap Uses

func NewMap() Map

Directories

PathSynopsis
lockstore

Package concurrent imports 2 packages (graph) and is imported by 1 packages. Updated 2017-08-05. Refresh now. Tools for package owners.