1.1.3 • Published 11 months ago

@remembered/s3-alternative-persistence v1.1.3

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

Actions Status Actions Status Actions Status Test Coverage Maintainability Packages npm version

S3 alternative persistence implementation for remembered redis

How to Install

npm i @remembered/s3-alternative-persistence

How to use

When creating a RememberedRedis instance, just inform the alternative persistence, as below

const remembered = new RememberedRedis(
  {
    ttl: 0,
    redisTtl: 3600,
    redisPrefix: 's3-cache',
    alternativePersistence: new S3Cache({
      s3, // s3 instance
      redis, // redis instance. optional
      bucketName: 'my-bucket',
      maxSavingDelay: 3,
      transientTtl: 300
    ),
  },
  redisInstance,
);

maxSavingDelay is meant to indicate to RememberedRedis how much it need to wait until the cache is save. The longer it waits, more values are inserted in the same S3 file, saving some requests, but bigger is the file and the memory consumption to deal with it, so measure that one carefully for your need. transientTll defines the maximum ttl to keep the same file content on redis. This is useful if you have some spare memory on your redis instance and wants to use it to make less GET requests on S3, saving some money with it. Also measure that for your need, and if you want to avoid using it at all, don't inform a redis instance, don't inform this property or inform it as 0.

You can also listen for error events: saveError and fetchingError. This will be emitted when either the communication with redis or S3 fails

License

Licensed under MIT.

1.1.1

11 months ago

1.0.2

11 months ago

1.1.0

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago

1.1.3

11 months ago

1.1.2

11 months ago

0.0.3

2 years ago