Skip to content

HarperFast/http-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

@harperdb/http-cache

A HarperDB Component for caching HTTP requests/responses from other components.

NPM Version

Installation

Go into the HarperDB application you would building and install this package and add it to the config.yaml file:

  1. Install:
npm install @harperdb/http-cache
  1. Add to config.yaml:
'@harperdb/http-cache':
  package: '@harperdb/http-cache'
  files: '/*'

Options

All configuration options are optional

port: number

Specify a port for the caching server. Defaults to 9926.

Cache handler options

  • clearRestIntervalCount - Number of records to invalidate prior to pausing when /invalidate endpoint is called
  • clearRestIntervalMs - Duration of pause in milliseconds when /invalidate endpoint is called
  • scheduledFullCacheClearTime - Time of day to perform a full cache clear (Expressed as hours in 24-hour format UTC time, i.e. 10.33 = 10:20 AM UTC)
  • additionalCacheDatabaseGroups - Array of additional database groups to use for caching. Each group will create a new database to store cached records.

Invalidation

Cache can be invalidated via a POST request to /invalidate

This will invalidate records from the default cache database. To invalidate records from an additional cache database, use the x-cache-group request header to specify the database group name.

i.e.

POST /invalidate
HEADER: 'x-cache-group: api'

About

A HarperDB Component for caching HTTP requests/responses from other components.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •