Categorygithub.com/imkira/go-ttlmap
modulepackage
2.0.0+incompatible
Repository: https://github.com/imkira/go-ttlmap.git
Documentation: pkg.go.dev

# README

go-ttlmap

License GoDoc Build Status Coverage codebeat badge goreportcard

go-ttlmap is a Go package that provides an in-memory key-value cache with notification events for storing TTL-based expirable items.

Install

First, you need to install the package:

go get -u github.com/imkira/go-ttlmap

Documentation

For advanced usage, make sure to check the available documentation here.

Examples

For examples check out the following code.

Contribute

Found a bug? Want to contribute and add a new feature?

Please fork this project and send me a pull request!

License

go-ttlmap is licensed under the MIT license:

www.opensource.org/licenses/MIT

Copyright

Copyright (c) 2016 Mario Freitas. See LICENSE for further details.

# Packages

No description provided by the author

# Functions

New creates a new Map with given options.
NewItem creates an item with the specified value and optional expiration.
WithExpiration creates an expiration time.
WithTTL creates an expiration time from a specified TTL.

# Constants

KeyExistAlready fails the opration if the key does not exist already.
KeyExistDontCare can be used to ignore wether a key exists or not.
KeyExistNotYet fails the operation if the key exists already.

# Variables

Errors returned Map operations.
Errors returned Map operations.
Errors returned Map operations.

# Structs

Item represents an item with an associated value and optional expiration.
Map is the equivalent of a map[string]interface{} but with expirable Items.
Options for initializing a new Map.
SetOptions for setting items on a Map.
UpdateOptions for updating items on a Map.

# Type aliases

KeyExistMode represents a restriction on the existence of a key for the operation to succeed.