store

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model struct{}

Model is the type on which all the core layer's functionality is implemented

func New

func New() Model

New returns Model core

func (Model) Get

func (m Model) Get(c *gofr.Context, key string) (string, error)

Get returns the value for a given key, throws an error, if something goes wrong.

func (Model) Set

func (m Model) Set(c *gofr.Context, key, value string, expiration time.Duration) error

Set accept key-value pair, and sets those in Redis, if expiration is non-zero value, it set an expiration(TTL) on those keys, if expiration is zero, then keys have no expiration time.

type Store

type Store interface {
	Get(ctx *gofr.Context, key string) (string, error)
	Set(ctx *gofr.Context, key, value string, expiration time.Duration) error
}

Store is the abstraction of core layer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL