All Projects → IISResetMe → PSCache

IISResetMe / PSCache

Licence: MIT license
Generic PowerShell cache implementation

Programming Languages

powershell
5483 projects

Labels

Projects that are alternatives of or similar to PSCache

endorphin
Key-Value based in-memory cache library which supports Custom Expiration Policies
Stars: ✭ 14 (-67.44%)
Mutual labels:  caching
adonis-cache
Cache provider for AdonisJS framework
Stars: ✭ 66 (+53.49%)
Mutual labels:  caching
cache warmup
Generiert den Cache vorab, so dass die Website bereits beim Erstaufruf performant läuft
Stars: ✭ 36 (-16.28%)
Mutual labels:  caching
django-cached-modelforms
🌟 ModelChoiceField implementation that can accept lists of objects, not just querysets
Stars: ✭ 14 (-67.44%)
Mutual labels:  caching
gocache
High performance and lightweight in-memory cache library with LRU and FIFO support as well as memory-usage-based-eviction
Stars: ✭ 15 (-65.12%)
Mutual labels:  caching
express-expeditious
flexible caching middleware for express endpoints
Stars: ✭ 42 (-2.33%)
Mutual labels:  caching
stash
Key-value store abstraction with plain and cache driven semantics and a pluggable backend architecture.
Stars: ✭ 71 (+65.12%)
Mutual labels:  caching
indexed-cache
A tiny Javsacript library for sideloading static assets on pages and caching them in the browser's IndexedDB for longer-term storage.
Stars: ✭ 56 (+30.23%)
Mutual labels:  caching
Johnny
Melodic Caching for Swift
Stars: ✭ 36 (-16.28%)
Mutual labels:  caching
EasyTask MVVM Kotlin
Todo app based on MVVM, Kotlin Coroutines, Navigation Component, Room Database, Retrofit, Data Binding
Stars: ✭ 49 (+13.95%)
Mutual labels:  caching
koa-cache-lite
Zero-dependency koa router cache
Stars: ✭ 27 (-37.21%)
Mutual labels:  caching
fastapi-etag
Convenience library for working with etags in fastapi
Stars: ✭ 19 (-55.81%)
Mutual labels:  caching
core
An advanced and highly optimized Java library to build frameworks: it's useful for scanning class paths, generating classes at runtime, facilitating the use of reflection, scanning the filesystem, executing stringified source code and much more...
Stars: ✭ 100 (+132.56%)
Mutual labels:  caching
java-core
Collections of solutions for micro-tasks created while building modules as part of project. Also has very fun stuffs :)
Stars: ✭ 35 (-18.6%)
Mutual labels:  caching
node-version-assets
Version your static assets with MD5 hashes using node.js
Stars: ✭ 65 (+51.16%)
Mutual labels:  caching
cachegrand
cachegrand is an open-source fast, scalable and secure Key-Value store, also fully compatible with Redis protocol, designed from the ground up to take advantage of modern hardware vertical scalability, able to provide better performance and a larger cache at lower cost, without losing focus on distributed systems.
Stars: ✭ 87 (+102.33%)
Mutual labels:  caching
denormalize
Simple denormalization for Meteor
Stars: ✭ 21 (-51.16%)
Mutual labels:  caching
WikiSearch
A flutter search engine based on MediaWiki with caching.
Stars: ✭ 39 (-9.3%)
Mutual labels:  caching
Fetch
A resource based network abstraction based on Alamofire.
Stars: ✭ 24 (-44.19%)
Mutual labels:  caching
retrocache
This library provides an easy way for configure retrofit for use a 2 layer cache (RAM and Disk)
Stars: ✭ 35 (-18.6%)
Mutual labels:  caching

PSCache

Generic PowerShell cache implementation


What is PSCache?

PSCache grew out of a need to abstract away a hashtable-based "caching" scheme that I personally found myself implementing over and over again. PSCache transparently caches the results from previous queries using a custom fetcher - a scriptblock that'll retrieve a value from elsewhere based on a single parameter.

Here's a simple example using PSCache as a transparent store for results returned from Get-ADUser:

Import-Module PSCache
$ADUserCache = New-PSCache -Fetcher { Get-ADUser $_ -Properties manager,title,employeeId }

# Fetch the user "jdoe" - this first cache-miss will cauce PSCache to call the `$Fetcher` scriptblock once and return the result
$ADUserCache.Get('jdoe')

# Fetch the user "jdoe" again - this time he'll be returned directly from the cache
$ADUserCache.Get('jdoe')

Which eviction policies are supported?

PSCache version 0.1.1 comes with 3 optional eviction policy implementations:

Least Recently Used (LRU)

Simple LRU policy which evicts the least recently cached entry

# Create a cache for URL page titles
$PageTitleCache = New-PSCache { param($url) (Invoke-WebRequest $url).title } -EvictionPolicy LRU -Capacity 3

# Grab a few url page titles
$PageTitleCache.Get('https://google.com')          # cache miss, cache count = 1
$PageTitleCache.Get('https://github.com')          # cache miss, cache count = 2
$PageTitleCache.Get('https://google.com')          # cache hit
$PageTitleCache.Get('https://stackoverflow.com')   # cache miss, cache count = 3
$PageTitleCache.Get('https://bing.com')            # cache miss, cache count = 3, 'https://github.com' evicted
$PageTitleCache.Get('https://github.com')          # cache miss, cache count = 3, 'https://google.com' evicted
$PageTitleCache.Get('https://google.com')          # cache miss, cache count = 3, 'https://stackoverflow.com' evicted

Most Recently Used (MRU)

Simple MRU policy which evicts the most recently cached entry

# Create a cache for URL page titles
$PageTitleCache = New-PSCache { param($url) (Invoke-WebRequest $url).title } -EvictionPolicy MRU -Capacity 3

# Grab a few url page titles
$PageTitleCache.Get('https://google.com')          # cache miss, cache count = 1
$PageTitleCache.Get('https://github.com')          # cache miss, cache count = 2
$PageTitleCache.Get('https://google.com')          # cache hit
$PageTitleCache.Get('https://stackoverflow.com')   # cache miss, cache count = 3
$PageTitleCache.Get('https://bing.com')            # cache miss, cache count = 3, 'https://stackoverflow.com' evicted
$PageTitleCache.Get('https://github.com')          # cache hit
$PageTitleCache.Get('https://google.com')          # cache hit

Least Frequently Used (LFU)

Simple LFU policy which evicts the least recently cached entry of those least frequently used

# Create a cache for URL page titles
$PageTitleCache = New-PSCache { param($url) (Invoke-WebRequest $url).title } -EvictionPolicy LFU -Capacity 3

# Grab a few url page titles
$PageTitleCache.Get('https://google.com')          # cache miss, cache count = 1
$PageTitleCache.Get('https://github.com')          # cache miss, cache count = 2
$PageTitleCache.Get('https://google.com')          # cache hit
$PageTitleCache.Get('https://stackoverflow.com')   # cache miss, cache count = 3
$PageTitleCache.Get('https://bing.com')            # cache miss, cache count = 3, 'https://stackoverflow.com' evicted
$PageTitleCache.Get('https://github.com')          # cache miss, cache count = 3, 'https://bing.com' evicted
$PageTitleCache.Get('https://google.com')          # cache hit

Roadmap

PSCache is currently very basic. Future plans include both time- and counter-based eviction policies (globally and per-key), as well as explicit cache size settings.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].