Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Mongo support. #26

Merged
merged 2 commits into from
Nov 26, 2015
Merged

Added Mongo support. #26

merged 2 commits into from
Nov 26, 2015

Conversation

jasny
Copy link
Collaborator

@jasny jasny commented Nov 26, 2015

Added Mongo support.

This was supported in 1.8, but missing in 2.0
Supports both the mongodb\mongodb library as the (legacy) mongo extension

Differenes from 1.8:

  • Constructor takes db object or collection object as argument
  • Use _id field rather than custom key field
  • Expired items are ignored rather than deleted (just like Mysqli)
  • Using upsert rather than delete + insert
  • Store TTL as date bson type to allow ttl index

Includes unit tests.
Usage guide is added to README.

Fixes #25

This was supported in 1.8, but missing in 2.0
Supports both the mongodb\mongodb library as the (legacy) mongo extension

Differenes from 1.8:
 - Constructor takes db and/or collection as arguments
 - Use `_id` field rather than custom `key` field
 - Expired items are ignored rather than deleted (just like Mysqli)
 - Using upsert rather than delete + insert
 - Store TTL as date bson type to allow ttl index

Includes unit tests.
Usage guide is added to README.

Fixes desarrolla2#25
@desarrolla2
Copy link
Owner

In version 2 I'm using different approach for adapter's constructors, i pass the entire backend object by constructor or nothing for default configuration you can see it here.

I think that approach is more flexible for final user.

If you want, you can to update your PR or wait for i have some time to update and then merge it.

Great work by the way!

Create default backend object is nothing is supplied
@jasny
Copy link
Collaborator Author

jasny commented Nov 26, 2015

Ok, it was already possible to pass the backend object, I just needed to remove the 2nd argument (which was optional).

I've made passing a backend optional. It will use the cache database if none is passed.

desarrolla2 added a commit that referenced this pull request Nov 26, 2015
@desarrolla2 desarrolla2 merged commit 5a9b1b5 into desarrolla2:master Nov 26, 2015
@desarrolla2
Copy link
Owner

thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants