DylanPiercey / receptacle

🏪 Multi purpose in memory lru cache with ttl support.
49 stars 13 forks source link

Support lifecycle events? #7

Open luzlab opened 4 years ago

luzlab commented 4 years ago

I appreciate this library and use it in several projects. Recently, I've had a use case where I need to run a function whenever a key is evicted. I made a fork and added an eventemitter to support this.

Would you be interested in a PR? If so, I'd appreciate feedback on what changes you think would be appropriate.

DylanPiercey commented 4 years ago

@luzlab I'd be concerned with the performance overhead of adding an event emitter here.

I feel like perhaps a fork would make more sense? If it could be implemented concisely and without a performance impact then I'd be less opposed.

luzlab commented 4 years ago

I opened a PR #8 with the proposed changes.