evolution-gaming / cats-helper

Helpers for cats & cats-effect
MIT License
49 stars 17 forks source link

implement ResourceCounter #229

Closed dfakhritdinov closed 1 year ago

dfakhritdinov commented 1 year ago

Motivation:

ResourceCounter provides caching mechanic for Resource by allocating source only once and caching its value & release effect. Every next ResourceCounter.resource will reuse cached value while release will be executed on releasing last resource ResourceCounter.resource.

ResourceCounter was inspired by Rust Arc and would be used in smetrics