tymondesigns / angular-locker

🗄️ A simple & configurable abstraction for local/session storage in angular js projects
https://npm.im/angular-locker
MIT License
314 stars 42 forks source link

Plans to add TTL or other expiration concept? #7

Closed uberspeck closed 9 years ago

uberspeck commented 9 years ago

Are there any plans to add TTL features? jStorage, for example, has a TTL feature that's pretty useful. I'd make a pull request but, to be honest, not too confident in my ability to implement it cleanly

tymondesigns commented 9 years ago

Hmm.. Not sure about that one. My concern is that I don't want the library to do too much, and become bloated with features that would rarely be useful.

Can you provide a scenario where you think this would be useful?

uberspeck commented 9 years ago

In my case I'm using local storage as a cache to reduce server requests. however I want the cached data to "expire" after a set time to prevent old data from hanging around. i can do this externally to angular-locker, but it would be awesome to just pass a TTL when setting data

* EDIT *

Just to give you an idea, here's the jStorage implementation - https://github.com/andris9/jStorage/blob/master/jstorage.js#L490

tymondesigns commented 9 years ago

OK I see what you mean. I will have a think as to how I would implement it, and probably throw together a quick prototype and see where I get.

Thanks!

uberspeck commented 9 years ago

awesome! Thanks for looking into it!

tymondesigns commented 9 years ago

decided not to add this for now.. might look at it again at some point