ExZarr.Storage.Backend.Memory (ExZarr v1.1.0)
View SourceIn-memory storage backend for Zarr arrays.
Stores chunks and metadata in an Elixir Agent for fast, temporary storage. Data is not persisted and will be lost when the process terminates.
Use Cases
- Temporary arrays during computation
- Testing and development
- Intermediate results that don't need persistence
- High-performance caching
Characteristics
- Fast: Direct memory access, no I/O overhead
- Non-persistent: Data lost on process termination
- Thread-safe: Uses Agent for concurrent access
- No configuration: No paths or connection strings needed
Example
# Create array with memory storage
{:ok, array} = ExZarr.create(
shape: {1000, 1000},
dtype: :float64,
storage: :memory
)
# Write and read data
ExZarr.Array.set_slice(array, data, start: {0, 0}, stop: {100, 100})
{:ok, result} = ExZarr.Array.get_slice(array, start: {0, 0}, stop: {100, 100})