| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Core.Server.Cache.Backend.Local.Internal
Description
Shared local capacity and transactional maintenance of separately typed stores.
Synopsis
- data LocalPool
- newLocalPool :: Int -> Int -> IO LocalPool
- newLocalPoolWithClock :: IO TimeSpec -> Int -> Int -> IO LocalPool
- registerStore :: LocalPool -> STM (Maybe TimeSpec) -> (TimeSpec -> STM ()) -> STM (CacheOccupancy, CacheOccupancy -> IO ()) -> IO ()
- runPool :: LocalPool -> (TimeSpec -> STM a) -> IO a
- readPool :: LocalPool -> (TimeSpec -> STM a) -> IO a
- poolFits :: LocalPool -> Int -> STM Bool
- adjustPool :: LocalPool -> Int -> Int -> STM ()
- poolEnabled :: LocalPool -> Bool
- poolAcceptsWeight :: LocalPool -> Int -> Bool
Documentation
The pool owns one aggregate counter. Registered actions hold no duplicate entry index.
newLocalPool :: Int -> Int -> IO LocalPool Source #
Build one aggregate bound for all registered local stores.
newLocalPoolWithClock :: IO TimeSpec -> Int -> Int -> IO LocalPool Source #
Supply the monotonic clock for deterministic expiry checks.
registerStore :: LocalPool -> STM (Maybe TimeSpec) -> (TimeSpec -> STM ()) -> STM (CacheOccupancy, CacheOccupancy -> IO ()) -> IO () Source #
Register maintenance without erasing a store's key or value type.
runPool :: LocalPool -> (TimeSpec -> STM a) -> IO a Source #
Expiry, entry changes and accounting commit together. Gauge reports keep commit order.
readPool :: LocalPool -> (TimeSpec -> STM a) -> IO a Source #
Reads bypass telemetry when no expiry is due. Actions must not change occupancy.
poolFits :: LocalPool -> Int -> STM Bool Source #
Test aggregate capacity for one additional entry without overflowing byte arithmetic.
adjustPool :: LocalPool -> Int -> Int -> STM () Source #
Apply the same committed delta as a store's own occupancy.
poolEnabled :: LocalPool -> Bool Source #
Zero aggregate capacity disables weighing and retention.