Versions in this module Expand all Collapse all v1 v1.0.3 Apr 18, 2025 v1.0.1 Apr 18, 2025 Changes in this version + const DefaultCleanupInterval + const DefaultMaxIdleTime + const DefaultMaxReferences + const MinCleanupInterval + const MinMaxIdleTime + const MinMaxReferences + var ErrContextClosed = errors.New("context is closed") + var ErrContextInUse = errors.New("context is currently in use") + var ErrContextManagerClosed = errors.New("context manager is closed") + var ErrContextNotFound = errors.New("context not found") + var ErrInvalidConfig = errors.New("invalid configuration") + var ErrInvalidContextType = errors.New("invalid context type") + var ErrMaxReferencesReached = errors.New("maximum references reached") + type ContextConfig struct + CleanupInterval time.Duration + MaxIdleTime time.Duration + MaxReferences int32 + type ContextManager struct + func NewContextManager(config *ContextConfig) *ContextManager + func (cm *ContextManager) Close() error + func (cm *ContextManager) CloseContext(ctxType MemoryContextType, locked bool) error + func (cm *ContextManager) GetOrCreateContext(ctxType MemoryContextType, config MemoryContextConfig) (*MemoryContext, bool, error) + func (cm *ContextManager) ReturnContext(ctx *MemoryContext) error + func (cm *ContextManager) StopCleanup() + func (cm *ContextManager) ValidateContext(ctx *MemoryContext) bool + type MemoryContext struct + func NewMemoryContext(config MemoryContextConfig) *MemoryContext + func (mc *MemoryContext) Close() error + func (mc *MemoryContext) CreateChild() (*MemoryContext, error) + func (mc *MemoryContext) CreatePool(objectType reflect.Type, config pool.PoolConfig, allocator func() any, ...) error + func (mc *MemoryContext) GetChildren() []*MemoryContext + func (mc *MemoryContext) RegisterChild(child *MemoryContext) + func (mm *MemoryContext) Acquire(objectType reflect.Type) any + func (mm *MemoryContext) GetPool(objectType reflect.Type) *pool.Pool[any] + func (mm *MemoryContext) Release(objectType reflect.Type, obj any) bool + type MemoryContextConfig struct + ContextType MemoryContextType + Parent *MemoryContext + type MemoryContextType string