class StaticAssets::MemoryStore

Overview

In-memory asset store for single-binary deployments (MemoryStore.from_dir or embed_file).

Included Modules

Defined in:

static_assets/store.cr

Constructors

Instance Method Summary

Instance methods inherited from module StaticAssets::Store

directory?(relative_path : String) : Bool directory?, resolve(relative_path : String, accept_encoding : String | Nil, precompressed : Bool = true) : ResolvedAsset | Nil resolve

Constructor Detail

def self.from_dir(dir : String) : MemoryStore #

Loads an entire directory tree into memory, automatically pairing .br and .gz sidecars.


[View source]
def self.new #

[View source]

Instance Method Detail

def add(path : String, data : Bytes | String, content_type : String | Nil = nil, last_modified : Time = Time.utc, brotli : Bytes | String | Nil = nil, gzip : Bytes | String | Nil = nil) : self #

Registers an asset in memory with a SHA-256 strong ETag and optional precompressed variants.


[View source]
def has_key?(path : String) : Bool #

[View source]
def resolve(relative_path : String, accept_encoding : String | Nil, precompressed : Bool = true) : ResolvedAsset | Nil #
Description copied from module StaticAssets::Store

Resolves relative_path (slash-delimited, without leading /) and selects the preferred representation according to accept_encoding.


[View source]
def size : Int32 #

[View source]