cache

package
v0.0.0-...-7a56003 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package cache caches Twilio API requests for fast loading.

Fetching a second page of resources from Twilio can be extremely slow - one second or more. Often we know the URL we want to fetch in advance - the first page of Messages or Calls, and any next_page_uri as soon as a user retrieves any individual page. Fetching the page and caching it can greatly improve latency.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	log.Logger
	// contains filtered or unexported fields
}

func NewCache

func NewCache(size int, l log.Logger) *Cache

func (*Cache) Get

func (c *Cache) Get(key string, val interface{}) (uint64, error)

Get gets the value at the key and decodes it into val. Returns the time the value was stored in the cache, or an error, if the value was not found, expired, or could not be decoded into val.

func (*Cache) Set

func (c *Cache) Set(key string, val interface{}, timeout time.Duration)

Jump to

Keyboard shortcuts

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