{"record":{"id":"8e300cd804a37b2e","repo":"kataras/iris","slug":"not-implemented-yet","errorCode":null,"errorMessage":"not implemented yet","messagePattern":"not implemented yet","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"info","filePath":"sessions/database.go","lineNumber":17,"sourceCode":"package sessions\n\nimport (\n\t\"errors\"\n\t\"reflect\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/kataras/iris/v12/context\"\n\t\"github.com/kataras/iris/v12/core/memstore\"\n\n\t\"github.com/kataras/golog\"\n)\n\n// ErrNotImplemented is returned when a particular feature is not yet implemented yet.\n// It can be matched directly, i.e: `isNotImplementedError := sessions.ErrNotImplemented.Equal(err)`.\nvar ErrNotImplemented = errors.New(\"not implemented yet\")\n\n// Database is the interface which all session databases should implement\n// By design it doesn't support any type of cookie session like other frameworks.\n// I want to protect you, believe me.\n// The scope of the database is to store somewhere the sessions in order to\n// keep them after restarting the server, nothing more.\n//\n// Synchronization are made automatically, you can register one using `UseDatabase`.\n//\n// Look the `sessiondb` folder for databases implementations.\ntype Database interface {\n\t// SetLogger should inject a logger to this Database.\n\tSetLogger(*golog.Logger)\n\t// Acquire receives a session's lifetime from the database,\n\t// if the return value is LifeTime{} then the session manager sets the life time based on the expiration duration lives in configuration.\n\tAcquire(sid string, expires time.Duration) memstore.LifeTime\n\t// OnUpdateExpiration should re-set the expiration (ttl) of the session entry inside the database,\n\t// it is fired on `ShiftExpiration` and `UpdateExpiration`.","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/kataras/iris/blob/7bedaf55a0b64bbb2248a5845a2c60d81a30996a/sessions/database.go#L1-L35","documentation":"sessions.ErrNotImplemented is returned by the sessions Database interface for features a specific database backend does not support, notably OnUpdateExpiration on backends that cannot reset TTLs. The docs suggest matching it directly with sessions.ErrNotImplemented.Equal(err).","triggerScenarios":"Calling db.OnUpdateExpiration(...) on a session database (e.g. a custom or basic backend) that has not implemented expiration updates; the method's default/implementing body returns this sentinel.","commonSituations":"Switching session storage backends (memory -> badger/boltdb/redis) and assuming all expose expiration updates; writing a custom sessions.Database that leaves optional methods unimplemented.","solutions":["Check errors.Is / err.Equal(sessions.ErrNotImplemented) and treat expiration updates as a no-op for that backend.","Choose a backend that supports expiration updates (e.g. Redis-based) if TTL refresh is required.","Implement OnUpdateExpiration in your custom Database by rewriting the record with a new TTL.","Recreate/expire sessions manually based on your storage's native TTL mechanism."],"exampleFix":"// before\nerr := db.OnUpdateExpiration(sid, newLifetime) // panics flow assumes always supported\n\n// after\nif err := db.OnUpdateExpiration(sid, newLifetime); err != nil && !errors.Is(err, sessions.ErrNotImplemented) {\n    return err // ignore only the not-implemented case\n}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"func supportsExpirationUpdate(db sessions.Database) bool {\n    return !errors.Is(db.OnUpdateExpiration(\"probe\", 1*time.Minute), sessions.ErrNotImplemented)\n}","tryCatchPattern":"if err := db.OnUpdateExpiration(sid, lt); err != nil && errors.Is(err, sessions.ErrNotImplemented) {\n    // backend ignores TTL updates — treat as no-op\n    err = nil\n}","preventionTips":["Check backend feature support before switching session storage.","Wrap optional Database methods with not-implemented checks.","Pin backend selection to requirements (TTL refresh vs simple KV)."],"tags":["sessions","database","not-implemented","iris"],"backgroundTag":"feature-not-implemented","analyzedSha":"7bedaf55a0b64bbb2248a5845a2c60d81a30996a","analyzedAt":"2026-08-30T20:38:16.250Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}