New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ltycache

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ltycache

A browser cache based on local storage.

latest
Source
npmnpm
Version
1.0.11
Version published
Maintainers
1
Created
Source

A browser cache based on local storage.

Why?

Because the browser cookie capacity is too small to meet the large file storage, localstorage has no expiration time. So ltycache is a memory that can store large files and set expiration time.

Installation

npm i -D ltycache

Usage

import {cache} from 'ltycache'
const cache = new cache()

// async
cache.setItem('name', 'laitingyou', 2000).then(res=>{
  console.log(res)
}).catch(e=>{})

cache.getItem('name').then(res=>{
  console.log(res)
}).catch(e=>{})

// aync
let res1 = cache.syncSetItem('name', 'Mr Lai', 2000)

const name = cache.syncGetItem('name')
console.log(name) // result: Mr Lai

setTimeout(_ => {
    const name = cache.syncGetItem('name')
    console.log(name) // result: null
}, 3000)

API

setItem(key, value, ms)

异步设置缓存

getItem(key)

异步获取缓存

syncSetItem(key, value, ms)

同步设置缓存

syncGetItem(key)

同步获取缓存

Keywords

cache

FAQs

Package last updated on 14 Jan 2020

Did you know?

Socket

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.

Install

Related posts