mirror of
https://github.com/kataras/iris.git
synced 2026-01-08 20:41:57 +00:00
SessionsPolicy and sessions adaptor, history and _example written.
Former-commit-id: e8b0dde3cb3b72919f01b9d836d8ccb3d4e20214
This commit is contained in:
29
adaptors/sessions/sessiondb/README.md
Normal file
29
adaptors/sessions/sessiondb/README.md
Normal file
@@ -0,0 +1,29 @@
|
||||
## Session databases
|
||||
|
||||
Find more databases at [github.com/kataras/go-sessions/sessiondb](https://github.com/kataras/go-sessions/tree/master/sessiondb).
|
||||
|
||||
This folder contains only the redis database because the rest (two so far, 'file' and 'leveldb') were created by the Community.
|
||||
So go [there](https://github.com/kataras/go-sessions/tree/master/sessiondb) and find more about them. `Database` is just an
|
||||
interface so you're able to `UseDatabase(anyCompatibleDatabase)`. A Database should implement two functions, `Load` and `Update`.
|
||||
|
||||
**Database interface**
|
||||
|
||||
```go
|
||||
type Database interface {
|
||||
Load(string) map[string]interface{}
|
||||
Update(string, map[string]interface{})
|
||||
}
|
||||
```
|
||||
|
||||
```go
|
||||
import (
|
||||
"...myDatabase"
|
||||
)
|
||||
s := New(...)
|
||||
s.UseDatabase(myDatabase) // <---
|
||||
|
||||
app := iris.New()
|
||||
app.Adapt(s)
|
||||
|
||||
app.Listen(":8080")
|
||||
```
|
||||
Reference in New Issue
Block a user