jrumbut/eloquent-memoize

Conditionally disable memoization?

Closed this issue · 2 comments

Hi!

I've come across a use case in which it would be desirable to temporarily disable memoization (particularly in unit tests where we might expect a value to change to test that it's working properly).

Is there a way to disable a memoized attribute, or specifically unset it?

Off the top of my head I think this should do it, let me know if it doesn't that seems like a reasonable feature:

Model::disableMemoization();

// do stuff...

Model::enableMemoization();

Hi @calvinl,

Closing and assuming it's working for you, let me know if there are still issues!

Sincerely,
Josh