redisdir

package
v0.0.0-...-ef8e99b Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0, MIT Imports: 10 Imported by: 0

Documentation

Overview

Identity Directory implementation with tiered caching, using Redis.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisDirectory

type RedisDirectory struct {
	Inner  identity.Directory
	ErrTTL time.Duration
	HitTTL time.Duration
	// contains filtered or unexported fields
}

Uses redis as a cache for identity lookups.

Includes an in-process LRU cache as well (provided by the redis client library), for hot key (identities).

func NewRedisDirectory

func NewRedisDirectory(inner identity.Directory, redisURL string, hitTTL, errTTL time.Duration, lruSize int) (*RedisDirectory, error)

Creates a new caching `identity.Directory` wrapper around an existing directory, using Redis and in-process LRU for caching.

`redisURL` contains all the redis connection config options. `hitTTL` and `errTTL` define how long successful and errored identity metadata should be cached (respectively). errTTL is expected to be shorted than hitTTL. `lruSize` is the size of the in-process cache, for each of the handle and identity caches. 10000 is a reasonable default.

func (*RedisDirectory) Lookup

func (*RedisDirectory) LookupDID

func (d *RedisDirectory) LookupDID(ctx context.Context, did syntax.DID) (*identity.Identity, error)

func (*RedisDirectory) LookupHandle

func (d *RedisDirectory) LookupHandle(ctx context.Context, h syntax.Handle) (*identity.Identity, error)

func (*RedisDirectory) Purge

func (*RedisDirectory) ResolveHandle

func (d *RedisDirectory) ResolveHandle(ctx context.Context, h syntax.Handle) (syntax.DID, error)

Jump to

Keyboard shortcuts

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