Image for Stash

Stash

Dead simple caching service in Go, based on Laravels cache service.

1 min read package

Stash is my attempt at implementing a similar API to Laravels cache service

Basic usage

import (
  "time"
  "github.com/smc13/stash"
)

drv := stash.NewFileDriver("./cache")

service := stash.New(drv)

// Add an item to the cache
err := service.Put(ctx, stash.StashItem{"key", "the value", time.Now().Add(5 * time.Minute)})

// Get the item back from the cache
item, err := service.Get(ctx, "key")