loopback-next icon indicating copy to clipboard operation
loopback-next copied to clipboard

Examples: Added new Redis Cache Example

Open sohaibahsan007 opened this issue 3 years ago • 3 comments

Redis cache example uses loop-api-cache package. The example describes detailed steps for creating a cache. Firstly, you must create a cache model and a data source (Redis key-value connector) to connect with Redis. Then, implement a cache strategy provider. Here you can write custom logic for getting and setting cached values. In sequence, add a check to see if for a given request there is already a cached value present. If yes, you can just return the cached value instead of getting it from the database. Add @cache(60)on any controller method to add caching. Parameter for cache decorator is the TTL (time to live)value for cache in seconds.

Checklist

  • [x] DCO (Developer Certificate of Origin) signed in all commits
  • [x] npm test passes on your machine
  • [x] New tests added or existing tests modified to cover all changes
  • [x] Code conforms with the style guide
  • [x] API Documentation in code was updated
  • [x] Documentation in /docs/site was updated
  • [x] Affected artifact templates in packages/cli were updated
  • [x] Affected example projects in examples/* were updated

sohaibahsan007 avatar Mar 15 '22 15:03 sohaibahsan007

Hi @raymondfeng, Hope you are doing well. can you please take a look at our PR when you have time?

Thank you.

sohaibahsan007 avatar Mar 31 '22 11:03 sohaibahsan007

Pull Request Test Coverage Report for Build 2070729644

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-76.06%) to 0.0%

Totals Coverage Status
Change from base Build 2068694465: -76.06%
Covered Lines: 0
Relevant Lines: 0

💛 - Coveralls

coveralls avatar Mar 31 '22 11:03 coveralls