# ezcache ezcache is a simple in-memory cache for golang that has data expiry. ## Usage ```go import "codeberg.org/danjones000/ezcache" // ... // Create a user cache which will cache users for five minutes userCache := ezcache.New(func(id uint64) (User, error) { // logic to fetch user from database return User{}, nil }, 5 * time.Minute) user, err := user.Get(userID) // Next time you do user.Get with the same userID within five minutes, it will be fetched from cache. // After five minutes, it will fetch from the database again. ```