5.9.83 • Published 4 months ago

@taktikorg/excepturi-id v5.9.83

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

@taktikorg/excepturi-id

A stupidly simple key/value storage using files to persist the data

NPM Version tests codecov npm

install

npm i --save @taktikorg/excepturi-id

Usage

const flatCache = require('@taktikorg/excepturi-id');
// loads the cache, if one does not exists for the given
// Id a new one will be prepared to be created
const cache = flatCache.load('cacheId');

// sets a key on the cache
cache.setKey('key', { foo: 'var' });

// get a key from the cache
cache.getKey('key'); // { foo: 'var' }

// fetch the entire persisted object
cache.all(); // { 'key': { foo: 'var' } }

// remove a key
cache.removeKey('key'); // removes a key from the cache

// save it to disk
cache.save(); // very important, if you don't save no changes will be persisted.
// cache.save( true /* noPrune */) // can be used to prevent the removal of non visited keys

// loads the cache from a given directory, if one does
// not exists for the given Id a new one will be prepared to be created
const cache = flatCache.load('cacheId', path.resolve('./path/to/folder'));

// The following methods are useful to clear the cache
// delete a given cache
flatCache.clearCacheById('cacheId'); // removes the cacheId document if one exists.

// delete all cache
flatCache.clearAll(); // remove the cache directory

Motivation for this module

I needed a super simple and dumb in-memory cache with optional disk persistance in order to make a script that will beutify files with esformatter only execute on the files that were changed since the last run. To make that possible we need to store the fileSize and modificationTime of the files. So a simple key/value storage was needed and Bam! this module was born.

Important notes

  • If no directory is especified when the load method is called, a folder named .cache will be created inside the module directory when cache.save is called. If you're committing your node_modules to any vcs, you might want to ignore the default .cache folder, or specify a custom directory.
  • The values set on the keys of the cache should be stringify-able ones, meaning no circular references
  • All the changes to the cache state are done to memory
  • I could have used a timer or Object.observe to deliver the changes to disk, but I wanted to keep this module intentionally dumb and simple
  • Non visited keys are removed when cache.save() is called. If this is not desired, you can pass true to the save call like: cache.save( true /* noPrune */ ).

License

MIT © Jared Wray

hasOwnPropertystringtypesafeArray.prototype.includessequence@@toStringTagdropequalityirqtrimRighttrimStartbusylintsyntaxerrornested csseslintfunctionspropvalidateshellobjectremoveserializerecmascriptsafetypeofvaluefull-widthECMAScript 6stylesECMAScript 5cryptcloudfrontbindfast-clonemruagentpathECMAScript 2022isConcatSpreadableconfiglockfileURLSearchParamstextquotehandlerspackage.jsonES2015asciireact-hookscall-boundsomekeyssigtermforkbrowserlistbyteRxStreamsObject.fromEntriesArrayBuffer#slicewgetspinnersajvlocalbootstrap csssettingsweaksetpromiselocationdeep-clonedependenciesmoduletriminspectjavascriptvpcwaapiauthES2021containsbrowserslistignorearrayescapedescriptorcallbounddeletegroupBysameValueZerocssemitECMAScript 3npmignoredeterministicestreereactstructuredCloneinstallertostringtagless csschildjQueryprefixopensslchromeasterisksjshintprocesstestinges7assertslastECMAScript 2016eslintpluginFunction.prototype.namecomputed-typesless.jsprivate datadefinespinnerroutingbannerrobustcolumnsstyleguideglobal objectexecsyntaxrulesregexptypeerrorlazyES6TypedArrayfront-endreadablestreamsetImmediatebuffersautoprefixerweakmapBigInt64ArrayWebSocketposekeyfunctionalargvclonei18nES2017ECMAScript 7nodejsObject.keysfastmatchAllreplayinstallforEachparserES2018prototypeES2023bufferencryptionES3ECMAScript 2015sqselmsnsexecutechanneldatapackagesloggingcryptoHyBicallcodesexit-codepatchReactiveExtensionsgroupcreatecircularviewArray.prototype.flatECMAScript 2018hookformconfigurablehasshimhardlinkscloudtrailtrimLeftjsdiffeventscoremkdirsphonevalidationidentifierswhatwgrgbl10nshebangjswritablepruneES2016performanceformsdeepclonezerodirpreserve-symlinksMicrosoftmacosfilterflagsfindLastIndexCSSStyleDeclarationfunction.lengthArray.prototype.filterfastclonerecursiveES2022package managerframeres2015json-schematermtypedarraydescriptors_.extendjsonrouteoutputfileInt16ArrayglobgetPrototypeOfebscensorextraes5deeppropertystreamjsdomdayjsiampureRxJSstyled-componentsargsclassescss variablerapidless mixinscompile lessvarSymbolArray.prototype.findLastIndexgenericsformpredictablecjkexitcolorstoolshandlerttyPromisesortedoffsetcommanderdatastructure0directoryserializeissymbolObject.definePropertyCSSio-tscloudformationhashindicatoramazonfixed-widthenvironmentuploadinloadingwindowreadabledragmergeyupspeedservercore-jsliveless compilerback-endfindgetoptimportexportFloat64ArrayjoimapreduceworkflowUint8Arrayvalidregular-expression-0eslintconfigdescriptionxhrincludeslibphonenumberenderwritepostcssglobal this valueArray.prototype.findLastcachegradients cssfromtslibcurriedbabel-coreflatredacttoobjectString.prototype.matchAllmatchesharmonysymlinksWebSocketsES2020minimalpersistentRegExp#flagstoArray$.extendponyfilleveryrequesthookselasticachenamestatetypescriptpluginArray.prototype.flatMaphas-ownStyleSheetoptimisterror-handlingcharacterstyleconsumeECMAScript 2019windowslinux3dhasOwnString.prototype.trimmakemanagersliceglobalThiswafeslint-plugincallbindregexjsonschemaes-shim APIassertioncheckglobalspringsetterschemahelpersextendbeanstalkArrayBuffernumbernamesfast-copydomutilReflect.getPrototypeOfimmerdataviewjwtpyyamlmixinsrdsfastcopyoptionUint32Arraysuperagenttddgetcopysymbolspnpm9typanioncommandprogressenvironmentsiemkdirpiteratecommand-lineJSON-SchemaTypeBoxwidthcss nestingtyped arrayarraybufferpropertiescss-in-jstelephonedatepositivevisualclassnameObservabledeepcopyramdautilitygitignoreprotobufES8fluxredirectelectronzxletregular expressionclassnamesArray.prototype.flattenutilitiestypedarraysa11yimmutableemrfetchReactiveXswfidlemkdirstatelessprotoregularspawnvariables in cssprotocol-buffersvalidatortouchefficientes6AsyncIteratorenvnopeinternal slotbinarylesscsssideUint8ClampedArraybyteOffsetjsxnegativeacornstringifyreduceflatMapglacierArray.prototype.containsclientRegExp.prototype.flagshttpsUint16ArrayexpressionaccessorECMAScriptdom-testing-libraryselfstarterbundlingpreprocessormulti-packageECMAScript 2020errorautoscalingawesomesauceespreeFloat32ArraytoSortedfpdynamodbdataViewcollection.es6Objectmetadata[[Prototype]]takequerydiffsignedfslinkbrowser.envgradients css3chineseterminalformatrandomaststringifierTypeScriptES5json-schema-validatoruser-streamss3higher-orderArrayhotwaitassignWeakSettesterfigletobjserviceloghttpgetterESnextPushfunctionproxyimportECMAScript 2023slotESconcatprettylessanimationeventDispatcherexpressairbnbreact animationbundlerECMAScript 2017interruptsmatchaws.gitignorechaizodMapObject.getPrototypeOfnodeECMAScript 2021workspace:*columnperformantbcrypt
5.9.83

4 months ago

5.9.82

4 months ago

5.9.81

4 months ago

5.9.80

4 months ago

5.9.79

4 months ago

5.9.78

4 months ago

5.9.77

4 months ago

5.9.76

4 months ago

5.9.75

4 months ago

5.9.74

4 months ago

5.9.73

5 months ago

5.9.72

5 months ago

5.9.71

5 months ago

5.9.70

5 months ago

5.9.69

5 months ago

5.9.68

5 months ago

5.8.68

5 months ago

5.8.67

5 months ago

5.8.66

5 months ago

5.8.65

5 months ago

5.8.64

5 months ago

5.7.64

5 months ago

5.7.63

5 months ago

5.7.62

5 months ago

5.7.61

5 months ago

5.6.61

5 months ago

4.6.61

5 months ago

4.6.60

5 months ago

4.6.59

5 months ago

4.6.58

5 months ago

4.6.57

5 months ago

4.5.57

5 months ago

4.5.56

5 months ago

4.5.55

5 months ago

4.5.54

5 months ago

4.5.53

5 months ago

4.5.52

5 months ago

4.5.51

5 months ago

4.5.50

5 months ago

4.5.49

5 months ago

4.5.48

6 months ago

3.5.48

6 months ago

3.5.47

6 months ago

3.5.46

6 months ago

3.5.45

6 months ago

3.5.44

6 months ago

3.5.43

6 months ago

3.5.42

6 months ago

2.5.42

6 months ago

1.5.42

6 months ago

1.5.41

6 months ago

1.5.40

6 months ago

1.5.39

6 months ago

1.5.38

6 months ago

1.5.37

6 months ago

1.4.37

6 months ago

1.4.36

6 months ago

1.4.35

6 months ago

1.4.34

6 months ago

1.4.33

6 months ago

1.4.32

6 months ago

1.4.31

6 months ago

1.4.30

6 months ago

1.4.29

6 months ago

1.4.28

6 months ago

1.4.27

6 months ago

1.4.26

6 months ago

1.4.25

6 months ago

1.4.24

6 months ago

1.4.23

6 months ago

1.4.22

7 months ago

1.4.21

7 months ago

1.4.20

7 months ago

1.4.19

7 months ago

1.4.18

7 months ago

1.4.17

7 months ago

1.4.16

7 months ago

1.4.15

7 months ago

1.4.14

7 months ago

1.4.13

7 months ago

1.4.12

7 months ago

1.3.12

7 months ago

1.3.11

7 months ago

1.3.10

7 months ago

1.2.10

7 months ago

1.1.10

7 months ago

1.1.9

7 months ago

1.1.8

7 months ago

1.1.7

7 months ago

1.1.6

7 months ago

1.1.5

7 months ago

1.1.4

7 months ago

1.1.3

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago