Documentation
¶
Index ¶
- Variables
- func ExampleFeatureSessionMigration(useNewImpl bool)
- func MigrateGetSession(name, key string, c echo.Context, useNewImplementation bool) interface{}
- func MigrateSetSession(name, key string, value interface{}, c echo.Context, useNewImplementation bool)
- func NewDeleteSession(name string, c echo.Context)
- func NewGetSessionValue(name, key string, c echo.Context) interface{}
- func NewSetSessionValue(name, key string, value interface{}, c echo.Context)
- func OldDeleteSession(name string, c echo.Context)
- func OldGetSessionValue(name, key string, c echo.Context) interface{}
- func OldSetSessionValue(name, key, value string, c echo.Context)
- type Config
- type SessionCache
- type SessionManager
- func (sm *SessionManager) CleanupCache()
- func (sm *SessionManager) DeleteSession(sessionName string, c echo.Context) error
- func (sm *SessionManager) GetSession(sessionName string, c echo.Context) (*sessions.Session, error)
- func (sm *SessionManager) GetValue(sessionName, key string, c echo.Context) (interface{}, error)
- func (sm *SessionManager) SaveSession(sessionName string, c echo.Context, s *sessions.Session) error
- func (sm *SessionManager) SetMultipleValues(sessionName string, values map[string]interface{}, c echo.Context) error
- func (sm *SessionManager) SetValue(sessionName, key string, value interface{}, c echo.Context) error
- func (sm *SessionManager) StartCleanupRoutine()
Constants ¶
This section is empty.
Variables ¶
var EchoSessionsMutex sync.Mutex
Mantener para compatibilidad con código existente
var Manager = &SessionManager{ cache: make(map[string]*SessionCache), ttl: 5 * time.Minute, }
var MigrationConfig = Config{ UseSessionManager: false, CacheTTL: 5, CleanupInterval: 10, }
var PayloadSessionMutex sync.Mutex
Functions ¶
func ExampleFeatureSessionMigration ¶
func ExampleFeatureSessionMigration(useNewImpl bool)
Ejemplo de cómo actualizar feature_session.go gradualmente
func MigrateGetSession ¶
MigrateGetSession permite cambiar entre implementaciones con un flag
func MigrateSetSession ¶
func MigrateSetSession(name, key string, value interface{}, c echo.Context, useNewImplementation bool)
MigrateSetSession es un wrapper que mantiene la compatibilidad pero usa el Session Manager internamente
func NewDeleteSession ¶
func NewGetSessionValue ¶
func NewSetSessionValue ¶
func OldDeleteSession ¶
func OldGetSessionValue ¶
func OldSetSessionValue ¶
Types ¶
type SessionCache ¶
type SessionCache struct {
// contains filtered or unexported fields
}
type SessionManager ¶
type SessionManager struct {
// contains filtered or unexported fields
}
SessionManager maneja sesiones con concurrencia optimizada
func (*SessionManager) CleanupCache ¶
func (sm *SessionManager) CleanupCache()
CleanupCache limpia entradas antiguas del cache
func (*SessionManager) DeleteSession ¶
func (sm *SessionManager) DeleteSession(sessionName string, c echo.Context) error
DeleteSession elimina todos los valores de una sesión
func (*SessionManager) GetSession ¶
GetSession obtiene toda la sesión (para operaciones complejas)
func (*SessionManager) GetValue ¶
func (sm *SessionManager) GetValue(sessionName, key string, c echo.Context) (interface{}, error)
GetValue obtiene un valor de la sesión (operación de lectura)
func (*SessionManager) SaveSession ¶
func (sm *SessionManager) SaveSession(sessionName string, c echo.Context, s *sessions.Session) error
SaveSession guarda la sesión después de modificaciones
func (*SessionManager) SetMultipleValues ¶
func (sm *SessionManager) SetMultipleValues(sessionName string, values map[string]interface{}, c echo.Context) error
SetMultipleValues establece múltiples valores de forma atómica
func (*SessionManager) SetValue ¶
func (sm *SessionManager) SetValue(sessionName, key string, value interface{}, c echo.Context) error
SetValue establece un valor en la sesión (operación de escritura)
func (*SessionManager) StartCleanupRoutine ¶
func (sm *SessionManager) StartCleanupRoutine()
StartCleanupRoutine inicia una rutina de limpieza periódica