hapijs / hapijs/catbox-memory

Expose the cache's current size as part of the API

Open
#91 1 comment 0 reactions 0 assignees View on GitHub
feature
Dominant language
JavaScript
Stars
33
Forks
30
PR merge metrics
No merged PRs in 30d

Description

### Runtime

node.js

### Runtime version

22

### Module version

6.0.2

### Used with

another framework

### Any other relevant information

_No response_

### What problem are you trying to solve?

I'm working on a project that uses @hapi/catbox with @hapi/catbox-memory to cache some API calls on servers. As this caching is very important for the project we would like to improve our monitoring and be able to capture the size of the cache in our metrics.

### Do you have a new or modified API suggestion to solve the problem?

I've noticed that @hapi/catbox-memory has an internal `byteSize` property, but it's not exposed in the module's API (and not documented or included in the Typescript type definitions).

Would it be possible to expose this field? I would suggest a public `getCacheSize()` method for example.

I would happy to work on a pull request to add this, but wanted to make sure that not exposing this information was not by design.

Thank you!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.