All Projects → joway → lsdis

joway / lsdis

Licence: other
KV storage based on LocalStorage.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to lsdis

rocks4j
KV Store for Java backed by RocksDB
Stars: ✭ 13 (-23.53%)
Mutual labels:  kv-storage
regex-cache
Memoize the results of a call to the RegExp constructor, avoiding repetitious runtime compilation of the same string and options, resulting in dramatic speed improvements.
Stars: ✭ 39 (+129.41%)
Mutual labels:  cache
LocalCache
JAVA LocalCache -- JAVA 本地缓存工具类
Stars: ✭ 62 (+264.71%)
Mutual labels:  cache
ultrafetch
Node-based fetch backed with an RFC-7234 compliant filesystem cache.
Stars: ✭ 30 (+76.47%)
Mutual labels:  cache
cache
PSR-16 compatible cache library
Stars: ✭ 30 (+76.47%)
Mutual labels:  cache
qcache
In memory cache server with query capabilities
Stars: ✭ 36 (+111.76%)
Mutual labels:  cache
moment-cache
⏱ Simple utility to cache moment.js results and speed up moment calls.
Stars: ✭ 29 (+70.59%)
Mutual labels:  cache
ccache-gui
macOS GUI helper for ccache
Stars: ✭ 52 (+205.88%)
Mutual labels:  cache
bash-cache
Transparent caching layer for bash functions; particularly useful for functions invoked as part of your prompt.
Stars: ✭ 45 (+164.71%)
Mutual labels:  cache
punic
Punic is a remote cache CLI built for Carthage and Apple .xcframework
Stars: ✭ 25 (+47.06%)
Mutual labels:  cache
cache-command
Manages object and transient caches.
Stars: ✭ 12 (-29.41%)
Mutual labels:  cache
CacheLib
Pluggable in-process caching engine to build and scale high performance services
Stars: ✭ 637 (+3647.06%)
Mutual labels:  cache
microstream
High-Performance Java-Native-Persistence. Store and load any Java Object Graph or Subgraphs partially, Relieved of Heavy-weight JPA. Microsecond Response Time. Ultra-High Throughput. Minimum of Latencies. Create Ultra-Fast In-Memory Database Applications & Microservices.
Stars: ✭ 283 (+1564.71%)
Mutual labels:  cache
fastapi-cache
fastapi-cache is a tool to cache fastapi response and function result, with backends support redis and memcached.
Stars: ✭ 375 (+2105.88%)
Mutual labels:  cache
async-memo-ize
🛠 Memoize utility for async/await syntax and promises. It supports cache in memory or via Redis
Stars: ✭ 16 (-5.88%)
Mutual labels:  cache
hp-quiz
Harry Potter movies quiz. Experimenting with localStorage, SVG path animations and vue.observable
Stars: ✭ 42 (+147.06%)
Mutual labels:  localstorage
hk-cache-manager
Simple wrapper for Redis Cache with Stackoverflow.Redis & AspNetCore aim
Stars: ✭ 17 (+0%)
Mutual labels:  cache
proxpi
PyPI caching mirror
Stars: ✭ 19 (+11.76%)
Mutual labels:  cache
cachex
CacheX注解缓存框架
Stars: ✭ 39 (+129.41%)
Mutual labels:  cache
cache
LRU-based cache package for Go.
Stars: ✭ 25 (+47.06%)
Mutual labels:  cache

lsdis

npm CircleCI

KV storage based on LocalStorage.

Purpose

Cache requests with localStorage in the browser.

Install

# nodejs
npm i -S lsdis

Or

<!-- browser -->
<script src='https://cdn.jsdelivr.net/npm/lsdis@latest/dist/lsdis.min.js'></script>

Feature

  • Local storage API
  • Cache wrapper
  • Cache invalidate

Usage

LocalStorage - Low Level API

import LocalStorage from 'lsdis'

const storage = new LocalStorage()
const mykey = 'mykey'
const myval = 'myval'
const timeoutMs = 1000

// set value with timeout(/ms)
storage.set(mykey, myval, timeoutMs)

// if not existed, return null else return string
storage.get(mykey)

// delete by key
storage.del(mykey)

// flush all localstorage
storage.flush()

LocalCache - High Level API

import { LocalCache } from 'lsdis'

function getUser(username: string) {
  // fetch request data
  return { username }
}

const timeoutMs = 1000
const cache = new LocalCache({ timeout: timeoutMs })
const username = 'myname'

async function main() {
  // wrapper by key with function and args
  const result = await cache.wrapper(`getUser:${username}`, getUser, username)
  console.log(result)

  // wrapper by key with function
  const resultAsync = await cache.wrapper(`getUser:${username}`, async () => getUser(username))
  console.log(resultAsync)
}
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].