Popularity
5.9
Stable
Activity
3.8
Growing
369
8
23

Programming language: Go
License: MIT License
Latest version: v0.11.0

cachego alternatives and similar packages

Based on the "Multiple Backends." category.
Alternatively, view cachego alternatives based on common mentions on social networks and blogs.

  • Hord

    DISCONTINUED. Manage data in Go with a simple key-value interface supporting various databases. [Moved]

Do you think we are missing an alternative of cachego or a related project?

Add another 'Multiple Backends.' Package

README

Cachego

Build Status Codecov branch GoDoc Go Report Card License

Simple interface for caching

Installation

Cachego requires Go 1.13 or later.

go get github.com/faabiosr/cachego

Usage

package main

import (
    "log"
    "time"

    "github.com/faabiosr/cachego/sync"
)

func main() {
    cache := sync.New()

    if err := cache.Save("user_id", "1", 10*time.Second); err != nil {
        log.Fatal(err)
    }

    id, err := cache.Fetch("user_id")
    if err != nil {
        log.Fatal(err)
    }

    log.Printf("user id: %s \n", id)

    keys := cache.FetchMulti([]string{"user_id", "user_name"})

    for k, v := range keys {
        log.Printf("%s: %s\n", k, v)
    }

    if cache.Contains("user_name") {
        cache.Delete("user_name")
    }

    if _, err := cache.Fetch("user_name"); err != nil {
        log.Printf("%v\n", err)
    }

    if err := cache.Flush(); err != nil {
        log.Fatal(err)
    }
}

Supported drivers

Documentation

Read the full documentation at https://pkg.go.dev/github.com/faabiosr/cachego.

Development

Requirements

Makefile

// Clean up
$ make clean

//Run tests and generates html coverage file
$ make cover

// Up the docker containers for testing
$ make docker

// Format all go files
$ make fmt

//Run linters
$ make lint

// Run tests
$ make test

License

This project is released under the MIT licence. See LICENSE for more details.


*Note that all licence references and agreements mentioned in the cachego README section above are relevant to that project's source code only.