![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
@wealthbar/data-cache
Advanced tools
Provides a client side in-memory, limited size, data cache for storing results from server calls. It uses least-recently accessed (with a maximum) eviction algorithm instead of strict LRU.
dataCacheCtor({maxWeight,maxAccessed}): dataCacheType
function dataCacheCtor(
{
maxWeight,
maxAccessed,
}: {
maxWeight?: number,
maxAccessed?: number,
} = {}
): dataCacheType
Returns a new dataCache
. maxWeight
defaults to 1000000
and maxAccessed
defaults to 8
. "Weight" is used
instead of a specific size measurement; dataCacheObjectWeight
is provided as a default method for computing the
relative space requirements of an object and it's lookup key. Since we can't assume all objects stored will be
JSON serializable (or that the user wants to take that performance hit) the user is still responsible for providing
the weight of each entry in the cache (including the key size).
dataCacheObjectWeight({key,entry}):number
function dataCacheObjectWeight(
{
key,
entry,
}: {
key: string,
entry: object | undefined,
}
): number
Convenience function to compute the weight of a "POJO".
dataCacheEvict({dataCache,key}):void
function dataCacheEvict(
{
dataCache,
key,
}: {
dataCache: dataCacheType,
key: string,
}
):void
Evicts key
from the dataCache
.
dataCacheReap({ dataCache,weight}):void
function dataCacheReap(
{
dataCache,
weight,
}: {
dataCache: dataCacheType,
weight: number,
}
): void
Remove entries from the cache until a new entry of weight
can be added without exceeding the maxWeight
.
This will throw if weight
exceeded maxWeight
(i.e. the entry can't fit in the cache).
dataCachePut({dataCache,key,entry,weight}):void
function dataCachePut(
{
dataCache,
key,
entry,
weight,
}: {
dataCache: dataCacheType,
key: string,
entry: object | undefined,
weight: number,
}
): void
Adds an entry
to the dataCache
under the key key
, evicting if needed to accommodate its weight
.
dataCacheGet({dataCache,key,peek}): object | undefined
function dataCacheGet(
{
dataCache,
key,
peek,
}: {
dataCache: dataCacheType,
key: string,
peek?: boolean,
}
): object | undefined
Retrieves an entry
from the dataCache
under the key key
. If peek
is true
the access count is not
incremented. If the entry
is not in the cache (evicted or never been added) undefined
is returned.
FAQs
Client side data cache
The npm package @wealthbar/data-cache receives a total of 4 weekly downloads. As such, @wealthbar/data-cache popularity was classified as not popular.
We found that @wealthbar/data-cache demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.