cacheManager

package
v0.0.0-...-126e10b Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 15 Imported by: 0

README

Cache Manager

The purpose of this Service Mesh service is to provide a generic caching implementation, and an integration interface for cache initialization.

Dependencies

There are no servicemesh dependencies on other services.

Integration with other services

This service integrates with the following services:


This service exports an integration interface IsCacheManager with an alias Dependencncy which are intended to be used by other services for dependency resolution (see servicemesh.HasDependencies), and expose just the methods which other services should use.

type Dependency = Foo

type IsCacheManager interface {
    FlushAllCaches()
}

Other service can implement the following integration interface to automatically have their cache flushed (which passes a new cache) using their specific cache budget (which is given in bytes):

type HasCache interface {
    CacheBudget() int
    FlushCache(newCache *cache.Cache)
}

Lua service integration

Nothing is implemented for the lua integration at the time of writing.

Modal TUI service integration

This service integrates with the modal TUI service to provide a dashboard for viewing the current state of all caches being managed.

img.png

Web router service integration

If the web router service is present at servicemesh, this service will register routes for retrieving data.

The route slug for this service is cache, so all routes defined will be under that route group.

route method purpose
cache/stats GET yields the stats for all caches being manages as json
cache/flush GET flushes all caches being managed

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheStats

type CacheStats struct {
	ServiceName string
	Size        string
	Budget      string
	Saturation  float64
}

type Dependency

type Dependency = IsCacheManager

type HasCache

type HasCache interface {
	CacheBudget() int
	FlushCache(newCache *cache.Cache)
}

type IsCacheManager

type IsCacheManager interface {
	FlushAllCaches()
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func (*Service) ExportToLua

func (s *Service) ExportToLua(state *lua.LState)

func (*Service) FlushAllCaches

func (s *Service) FlushAllCaches()

func (*Service) Init

func (s *Service) Init(mesh servicemesh.Mesh)

func (*Service) InitRoutes

func (s *Service) InitRoutes(group *gin.RouterGroup)

func (*Service) Logger

func (s *Service) Logger() *slog.Logger

func (*Service) ModalTui

func (s *Service) ModalTui() (name string, model tea.Model)

func (*Service) Name

func (s *Service) Name() string

func (*Service) OnServiceAdded

func (s *Service) OnServiceAdded(service servicemesh.Service)

func (*Service) Ready

func (s *Service) Ready() bool

func (*Service) SetLogger

func (s *Service) SetLogger(logger *slog.Logger)

func (*Service) Slug

func (s *Service) Slug() string

func (*Service) UnexportFromLua

func (s *Service) UnexportFromLua(state *lua.LState)

Jump to

Keyboard shortcuts

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