Documentation
¶
Index ¶
- type Cookie
- type CookieData
- type Database
- func (s Database) Close() error
- func (s Database) Delete(key string) error
- func (s Database) DeleteWithContext(_ context.Context, key string) error
- func (s Database) Get(key string) ([]byte, error)
- func (s Database) GetWithContext(_ context.Context, key string) ([]byte, error)
- func (s Database) Reset() error
- func (s Database) ResetWithContext(_ context.Context) error
- func (s Database) Set(key string, val []byte, exp time.Duration) error
- func (s Database) SetWithContext(_ context.Context, key string, val []byte, exp time.Duration) error
- type Expiration
- type MemoryStore
- func (m *MemoryStore) Destroy(sid string) *session.Session
- func (m *MemoryStore) Get(sid string) *session.Session
- func (m *MemoryStore) Set(sid *string, session *session.Session)
- func (m *MemoryStore) ShutDown()
- func (m *MemoryStore) Shutdown()
- func (m *MemoryStore) StartCleanup(interval time.Duration)
- func (m *MemoryStore) StopCleanup()
- func (m *MemoryStore) Touch(sid string, session *session.Session)
- func (m *MemoryStore) UpdateExpirations(sid *string, session *session.Session, updateDbExp *bool) *session.Session
- func (m *MemoryStore) Write(sid string, session session.Session)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cookie ¶
type Cookie struct {
Path string
Domain string
SameSite string
MaxAge *int
HttpOnly bool
Secure bool
// contains filtered or unexported fields
}
func (*Cookie) GetData ¶
func (c *Cookie) GetData() CookieData
func (*Cookie) GetExpires ¶
GetExpires returns the expiration time of the cookie
func (*Cookie) SetExpires ¶
SetExpires sets the max age of the cookie
type CookieData ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database is a fiber.Storage adapter backed by the DataStore's `sessionstorage` table so that HTTP sessions survive server restarts.
The opaque session payload handed over by fiber is base64-encoded and stored in the session record's Connections field; the expiration instant is stored as an RFC3339 string in the Expires field (an empty Expires means the entry never expires). Expired entries are treated as missing on Get and lazily purged from the DataStore.
func NewSessionDatabase ¶
func (Database) Close ¶
Close is a no-op; the underlying DataStore's lifecycle is managed by the server, not by the session storage adapter.
func (Database) Delete ¶
Delete deletes the value for the given key. It returns no error if the storage does not contain the key.
func (Database) DeleteWithContext ¶ added in v0.6.3
DeleteWithContext deletes the value for the given key. It returns no error if the storage does not contain the key.
func (Database) Get ¶
Get gets the value for the given key. `nil, nil` is returned when the key does not exist or the entry has expired.
func (Database) GetWithContext ¶ added in v0.6.3
GetWithContext gets the value for the given key. `nil, nil` is returned when the key does not exist or the entry has expired.
func (Database) Reset ¶
Reset is a no-op: the DataStore interface offers no way to enumerate or bulk-delete session records. Fiber only calls Reset via an explicit store.Reset(), which Etherpad never does.
func (Database) ResetWithContext ¶ added in v0.6.3
ResetWithContext resets the storage and deletes all keys.
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
func NewMemoryStore ¶
func NewMemoryStore(db db.DataStore, refresh *int64) *MemoryStore
func (*MemoryStore) ShutDown ¶
func (m *MemoryStore) ShutDown()
func (*MemoryStore) Shutdown ¶
func (m *MemoryStore) Shutdown()
func (*MemoryStore) StartCleanup ¶ added in v0.6.0
func (m *MemoryStore) StartCleanup(interval time.Duration)
StartCleanup launches the periodic stale-session cleanup goroutine. Intended to be called once from server startup when cookie.sessionCleanup is true. Upstream #7448 / #7471.
func (*MemoryStore) StopCleanup ¶ added in v0.6.0
func (m *MemoryStore) StopCleanup()
StopCleanup terminates the background cleanup goroutine.