Open osr00 opened 3 months ago
This might be a good feature. We've got two options here:
SetBulk()
which would insert/update multiple items. (Still unclear: should we return multiple items as a result?)WithInitialData()
option that would be used when creating a cache.I presume the first option would work better in your situation?
For me both are good options.
For SetBulk just return an error or nil is sufficient for me. Maybe others see this differently
Because this will be used mainly on startup a WithInitialData option also is a good variant.
In the wild it will be rarely needed that a bulk update is needed after a start I guess. But who knows?
ttlcache is really a great thing. We save the state in intervals and on exit of the application in a yaml file.
We reload the state of the cache values on restart of the application.
What we miss is a function SetUnsafe which can be used without mutex locking. So it would be much faster on bulk reload.
There is a set function but this is only locally and cannot be used globally.