Github: https://github.com/mahdavipanah/keyv-upstash
keyv-upstash? Keyv? ???? Redis ???? Upstash Redis? ???? ???? ??????. ? ???? ???? ???? ??????? ?-? ??? ?? ???? ????? ??? ???? ?? ? ????.
Keyv? ??????
Keyv? ???? ?? ?? ???? ???? ??? ?-? ??? ????????. ??? ?????:
TTL ?? ??: ?? ?? ?? ??? ?????.
?????? ??: ?? ???? ? ??? ?????.
???: ??? ?? ??? ?? ????? ??? ?? ??? ??? ? ????.
Keyv? Redis, SQLite, MongoDB? ?? Upstash Redis? keyv-upstash ? ??? ???? ?? ?????.
? keyv-upstash???
keyv-upstash? Upstash Redis? ???? Keyv? ??? ???? ??? ?????.
???? ???: Upstash Redis? ??? ???? ?? ???? ???? ???? ?? ?????.
???: Keyv? ???? ???? ?? ?? ??? ?????.
?? ???: ??? ??? ?? Cacheable? ?????.
???? ?? ??: serverless-redis-http? ???? ????? ?? ???? Redis? ???? ? ???? ?? ??? ? ????.
????
keyv-upstash? ????? ?? ??? ????.
1. Keyv ? keyv-upstash ??
Keyv ? Upstash ??? ??:
npm install keyv keyv-upstash
?? ??: ???? ??? ?? Cacheable ??:
npm install cacheable
2. keyv-upstash ??
Upstash? Redis ??????? ???? ??? ?????. ?????? keyv-upstash? ???? ??? ??? ????.
?? ???
import Keyv from 'keyv'; import { KeyvUpstash } from 'keyv-upstash'; const keyv = new Keyv({ store: new KeyvUpstash({ url: 'your-upstash-redis-url', token: 'your-upstash-redis-token', }), }); // Set a key-value pair await keyv.set('foo', 'bar'); // Retrieve the value const value = await keyv.get('foo'); console.log(value); // 'bar'
?????? ??
??????? ? ??? ???? ?? ?? ??? ?????.
const keyv = new Keyv({ store: new KeyvUpstash({ url: 'your-upstash-redis-url', token: 'your-upstash-redis-token', namespace: 'my-namespace', }), }); await keyv.set('foo', 'bar'); // Stored as 'my-namespace::foo'
Cacheable? ??? ?? ???
?? ??? ?? keyv-upstash? Cacheable? ?????.
import { Cacheable } from 'cacheable'; const redisStore = new KeyvUpstash({ url: 'your-upstash-redis-url', token: 'your-upstash-redis-token', }); const cache = new Cacheable({ primary: new Map(), // Fast in-memory caching secondary: redisStore, // Persistent Redis caching }); await cache.set('foo', 'bar', { ttl: 1000 }); // Stores in both layers const value = await cache.get('foo'); // Fast lookup from memory or Redis console.log(value); // 'bar'
?? ??
?? ??
setMany ? getMany? ???? ?? ??:
await keyv.setMany([ { key: 'key1', value: 'value1' }, { key: 'key2', value: 'value2' }, ]); const values = await keyv.getMany(['key1', 'key2']); console.log(values); // ['value1', 'value2']
?? ??
defaultTtl, keyPrefixSeparator,clearBatchSize? ?? ???? ??? ???????.
? ??? keyv-upstash ??: ???? Redis? ?? ??? ?-? ????? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

Node.js?? HTTP ??? ???? ? ?? ???? ??? ????. 1. ?? ????? ????? ??? ??? ? ?? ????? ?? ?? ? https.get () ??? ?? ??? ??? ? ?? ????? ?? ??? ?????. 2.axios? ??? ???? ? ?? ??????. ??? ??? ??? ??? ??? ??? ???/???, ?? JSON ??, ???? ?? ?????. ??? ?? ??? ????? ?? ????. 3. ?? ??? ??? ??? ??? ???? ???? ??? ??? ???? ?????.

JavaScript ??? ??? ?? ?? ? ?? ???? ????. ?? ???? ???, ??, ??, ?, ???? ?? ? ??? ?????. ?? ????? ?? ?? ? ? ??? ????? ?? ??? ??? ????. ??, ?? ? ??? ?? ?? ??? ??? ??? ???? ??? ??? ???? ??? ?? ??? ????. ?? ? ????? ??? ???? ? ??? ? ??? TypeofNull? ??? ?????? ??? ? ????. ? ? ?? ??? ???? ?????? ????? ???? ??? ???? ? ??? ? ? ????.

?? JavaScript ??? ??? ??? ?????? ?? ??? ?? ?? ??? ?? ???? ????. 1. ??? ???? ???? ?? ??? ?? ? ? ???? ??? ??? ?? ? ?? ????? ?????. 2. Angular? ?????? ??? ?? ???? ? ?? ?? ??? ??? ??? ???? ?????. 3. VUE? ???? ?? ??? ???? ?? ?? ??? ?????. ?? ?? ?? ??, ? ??, ???? ???? ? SSR? ???? ??? ??? ??? ???? ? ??? ?????. ???, ??? ??? ??? ????? ????. ??? ??? ??? ??? ?? ????.

?????, JavaScript ???! ?? ? JavaScript ??? ?? ?? ?????! ?? ?? ??? ??? ??? ? ????. Deno?? Oracle? ?? ??, ??? JavaScript ?? ??? ????, Google Chrome ???? ? ??? ??? ???? ?????. ?????! Deno Oracle? "JavaScript"??? ????? Oracle? ?? ??? ??? ??????. Node.js? Deno? ??? ? Ryan Dahl? ??? ?????? ???? ????? JavaScript? ??? ???? Oracle? ????? ???? ?????.

Cacheapi? ?????? ?? ???? ??? ???? ???, ?? ??? ??? ?? ???? ? ??? ?? ? ???? ??? ??????. 1. ???? ????, ??? ??, ?? ?? ?? ???? ???? ??? ? ????. 2. ??? ?? ?? ??? ?? ? ? ????. 3. ?? ?? ?? ?? ?? ??? ??? ?? ?????. 4. ??? ???? ?? ?? ???? ?? ?? ?? ?? ?? ???? ?? ?? ??? ??? ? ????. 5. ?? ???? ??, ??? ??? ? ??? ??, ?? ??? ? ?? ???? ???? ???? ? ?? ?????. 6.?? ??? ?? ?? ?? ??, ???? ?? ? HTTP ?? ????? ?????? ???????.

??? JavaScript?? ??? ??? ?????? ?? ???????. ?? ??, ?? ?? ? ??? ??? ?? ????? ????? ?????. 1. ?? ??? ??? ????? ???? ??. ()? ?? ??? ??? ?????. ?. ()? ?? ??? ?? ??? ??? ?? ? ? ????. 2. ?? ??? .catch ()? ???? ?? ??? ??? ?? ??? ??????, ??? ???? ???? ????? ??? ? ????. 3. Promise.all ()? ?? ????? (?? ?? ?? ? ??????? ??), Promise.Race () (? ?? ??? ?? ?) ? Promise.AllSettled () (?? ??? ???? ??)

.map (), .filter () ? .reduce ()? ?? JavaScript ?? ?? ???? ??? ??? ??? ? ? ????. 1) .map ()? ??? ??? ??? ???? ? ??? ???? ? ?????. 2) .filter ()? ???? ??? ????? ? ?????. 3) .reduce ()? ???? ?? ??? ???? ? ?????. ???? ??? ????? ??? ?? ?? ??? ?????.

JavaScript? ??? ??? ?? ??, ? ? ? ?? ???? ???? ??? ??? ?????. 1. ?? ??? ?? ??? ???? ??? ??? ??? ??? ?? WebAPI? ?????. 2. WebAPI? ??????? ??? ?? ? ? ??? ?? ??? (??? ?? ?? ???? ??)? ????. 3. ??? ??? ?? ??? ?? ??? ?????. ?? ??? ??? ????? ??? ??? ?? ? ???? ?????. 4. ???? ?? (? : Promise. 5. ??? ??? ???? ?? ???? ???? ?? ?? ?? ??? ????? ? ??????.
