| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Core.Server.Cache.Store
Description
Local request coalescing with optional, separately owned retention.
Synopsis
- data SingleFlight e k v
- newSingleFlightWithBackend :: Maybe (RetentionBackend k v) -> IO (SingleFlight e k v)
- resolveSingleFlight :: Ord k => (CacheResult -> IO ()) -> (CacheOccupancy -> IO ()) -> IO () -> SingleFlight e k v -> k -> IO (Either e v) -> IO (Either e v)
- data PreparedStore e v
- prepareStore :: Ord k => (CacheResult -> IO ()) -> (CacheOccupancy -> IO ()) -> IO () -> SingleFlight e k v -> k -> IO (Either e v) -> IO (PreparedStore e v)
- executePrepared :: PreparedStore e v -> IO (Either e v)
- lookupStore :: (CacheOccupancy -> IO ()) -> IO () -> Recency -> SingleFlight e k v -> k -> IO (Maybe v)
- data CacheOccupancy = CacheOccupancy {
- occEntries :: Int
- occBytes :: Int
Documentation
data SingleFlight e k v Source #
Active requests own flight results. Completion removes the only registry reference.
newSingleFlightWithBackend :: Maybe (RetentionBackend k v) -> IO (SingleFlight e k v) Source #
Coalesce requests without retaining completed values when the backend is absent.
resolveSingleFlight :: Ord k => (CacheResult -> IO ()) -> (CacheOccupancy -> IO ()) -> IO () -> SingleFlight e k v -> k -> IO (Either e v) -> IO (Either e v) Source #
Share active work and release waiters on failure or cancellation. Capacity refusals and external backend faults use the refusal callback.
data PreparedStore e v Source #
A request-scoped read with any local value already pinned. Execute it once.
prepareStore :: Ord k => (CacheResult -> IO ()) -> (CacheOccupancy -> IO ()) -> IO () -> SingleFlight e k v -> k -> IO (Either e v) -> IO (PreparedStore e v) Source #
Capture local retention without claiming a flight or contacting external storage.
executePrepared :: PreparedStore e v -> IO (Either e v) Source #
Resolve the read, recording its request outcome only during execution.
lookupStore :: (CacheOccupancy -> IO ()) -> IO () -> Recency -> SingleFlight e k v -> k -> IO (Maybe v) Source #
Probe the selected storage. Recency is a hint, and unsupported retention reports zero occupancy.
data CacheOccupancy Source #
Entry count and summed accounted bytes after a store mutation.
Constructors
| CacheOccupancy | |
Fields
| |
Instances
| Show CacheOccupancy Source # | |
Defined in Ecluse.Core.Server.Cache.Backend.Internal Methods showsPrec :: Int -> CacheOccupancy -> ShowS # show :: CacheOccupancy -> String # showList :: [CacheOccupancy] -> ShowS # | |
| Eq CacheOccupancy Source # | |
Defined in Ecluse.Core.Server.Cache.Backend.Internal Methods (==) :: CacheOccupancy -> CacheOccupancy -> Bool # (/=) :: CacheOccupancy -> CacheOccupancy -> Bool # | |