Basic bucketing support #14

Merged
merged 2 commits into from May 15, 2012

Conversation

Projects
None yet
2 participants
Contributor

mattpowell commented Apr 17, 2012

The idea behind this change is to allow people running lscache from multiple pages/apps on the same domain to bucket their data in to different "storage areas". This doesn't necessarily protect your keys from being overwritten, but, could help. It also definitely makes it easier to flush a specific set of keys.

I contemplated two different techniques: adding an additional bucket parameter to the set/get/remove/flush methods; or adding in a keys method that returned back null for unsupported browsers and an array of keys for supported browsers. Ultimately, I went w/ setBucket because it's a simple call that could be made in some global config somewhere.

The original tests plus two new tests pass locally. Also, I kept my changes to README minimal because I know some people prefer to update that themselves :)

Thanks, and lmk if you have ?'s.

Owner

pamelafox commented May 15, 2012

Interesting-- I think an alternate way of doing this would be to pass the bucket name into every call, but I like this since it doesn't change the set/get API for people not using it. And since you're actually using this, I trust that you find this way better. I pulled and ran the tests, LGTM. Merging.

pamelafox added a commit that referenced this pull request May 15, 2012

@pamelafox pamelafox merged commit e62b82b into pamelafox:master May 15, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment