The memory store keeps all data in memory using Go maps with sync.RWMutex for thread safety. Data is lost when the process exits.
Usage01
import "github.com/xraph/warden/store/memory"
st := memory.New()Characteristics02
Thread-safe — All operations use read/write locks
Copy-on-write — List operations return copies, not references
No persistence — Data is lost on restart
No migrations —
Migrate()is a no-opFast — Ideal for unit tests and development
When to Use03
Unit tests and integration tests
Development environments
Prototyping and experimentation
Standalone scripts and CLI tools
Interface Compliance04
The memory store implements all 7 subsystem store interfaces:
var _ store.Store = (*memory.Store)(nil) // Compile-time checkThis includes:
role.Store— Role CRUD + hierarchypermission.Store— Permission CRUD + role attachmentassignment.Store— Assignment CRUD + subject lookuprelation.Store— Relation tuple CRUD + graph queriespolicy.Store— Policy CRUD + active policy lookupresourcetype.Store— Resource type CRUDchecklog.Store— Check log append + query