mongo_db_store 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 106d2508f9d1f55a92ee79900b51e1024f58d6c8
4
- data.tar.gz: 16ddb784eebcc132a5171423d09a056bfb9c2c86
3
+ metadata.gz: 1730120838a993e1eef564c0c0ea44f896e9eba3
4
+ data.tar.gz: 28f3292200d9987566a04df4a0a28682de767c6d
5
5
  SHA512:
6
- metadata.gz: d8fb781c9d262d5935d76034c226cd6c27aec1b96983d49c175f4bd7b1dc25ff09fc46386ae641d32b2dc59be18c2e368ba7f1f76a762305f74411f884271b8e
7
- data.tar.gz: '061128480e2702da02df49c9647f0710308db01f2b8f6afed5020e5abe34da54c0c3004ae4877b8428ccaa1231446ee3ca1308d5c5385aee42f322b03a7d46c3'
6
+ metadata.gz: a87f25a90d5b1517deaca534bb57270ded5e551c8885a04d8a94d2d9d78ceae2adbb343cae8ab75e7aee6daa187a65ef5d008afb85be753a3e65c7d48d6b751b
7
+ data.tar.gz: ae446a6fe5c1d99e75575d45a0c10f4e84a761c74fa0c19c7e12357153dc7c91e7e887590f616420a8a606b499a56bd6a9c6c57433b8c37b98845620eec6fd8d
data/.rubocop.yml CHANGED
@@ -10,10 +10,6 @@ AllCops:
10
10
  - "finapps.gemspec"
11
11
  UseCache: false
12
12
 
13
- # Commonly used screens these days easily fit more than 80 characters.
14
- Metrics/LineLength:
15
- Max: 120
16
-
17
13
  # No space makes the method definition shorter and differentiates
18
14
  # from a regular assignment.
19
15
  Style/SpaceAroundEqualsInParameterDefault:
data/README.md CHANGED
@@ -1,2 +1,61 @@
1
- # mongo_db_store
2
- Rails-compatible cache store for MongoDB using Mongoid
1
+ # MongoDbStore
2
+ ---------------
3
+
4
+ [![Gem Version](https://badge.fury.io/rb/mongo_db_store.svg)](https://badge.fury.io/rb/mongo_db_store)
5
+ [![Dependency Status](https://gemnasium.com/badges/github.com/qbantek/mongo_db_store.svg)](https://gemnasium.com/github.com/qbantek/mongo_db_store)
6
+ [![License](http://img.shields.io/:license-mit-blue.svg?style=flat-square)](http://mongo_db_store.mit-license.org)
7
+
8
+ Rails cache store for MongoDB using Mongoid. Compatible with Rails 5.
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ ```ruby
15
+ gem 'mongo_db_store'
16
+ ```
17
+
18
+ And then execute:
19
+
20
+ $ bundle
21
+
22
+ Or install it yourself as:
23
+
24
+ $ gem install mongo_db_store
25
+
26
+ ## Usage
27
+
28
+ ```ruby
29
+ # config/application.rb
30
+ config.session_store :mongo_db_store
31
+ ```
32
+
33
+ ## Configuration
34
+
35
+ By default, the cache entries will be stored in the "rails_cache" collection
36
+ and be expired in 1 day. To set different values:
37
+
38
+ ```ruby
39
+ # config/application.rb
40
+ config.session_store :mongo_db_store, collection: 'foo', expires_in: 90.minutes
41
+ ```
42
+
43
+
44
+ ## Development
45
+
46
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec spec` to run the tests.
47
+ You can also run `bin/console` for an interactive prompt that will allow you to experiment.
48
+
49
+ To install this gem onto your local machine, run `bundle exec rake install`.
50
+
51
+ ## Contributing
52
+
53
+ Bug reports and pull requests are welcome on GitHub at https://github
54
+ .com/qbantek/mongo_db_store.
55
+ This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere
56
+ to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
57
+
58
+
59
+ ## License
60
+
61
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -42,16 +42,18 @@ module ActiveSupport
42
42
  created_at = Time.now.utc.to_i
43
43
  value = options[:raw] ? entry.value.to_s : entry
44
44
  rescue_error_with false do
45
- collection.find(_id: key).update_one({'$set' => {data: Base64.encode64(Marshal.dump(value)),
46
- expires_at: expires_at,
47
- created_at: created_at}},
45
+ set = {data: Base64.encode64(Marshal.dump(value)),
46
+ expires_at: expires_at,
47
+ created_at: created_at}
48
+ collection.find(_id: key).update_one({'$set' => set},
48
49
  upsert: true)
49
50
  end
50
51
  entry
51
52
  end
52
53
 
53
54
  def read_entry(key, _)
54
- doc = collection.find(_id: key, expires_at: {'$gt' => Time.now.utc.to_i}).first
55
+ expiration_criteria = {'$gt' => Time.now.utc.to_i}
56
+ doc = collection.find(_id: key, expires_at: expiration_criteria).first
55
57
  rescue_error_with(nil) { deserialize_entry(doc['data']) } if doc
56
58
  end
57
59
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module MongoDbStore
3
- VERSION = '0.1.2'
4
+ VERSION = '0.1.3'
4
5
  end
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.add_runtime_dependency 'mongoid', '~> 6.1'
26
26
  spec.add_runtime_dependency 'activesupport', '~> 5.0'
27
27
 
28
- spec.add_development_dependency 'bundler', '~> 1.14'
29
- spec.add_development_dependency 'rake', '~> 10.0'
30
- spec.add_development_dependency 'rspec', '~> 3.0'
28
+ spec.add_development_dependency 'bundler', '~> 1.14', '>= 1.14.6'
29
+ spec.add_development_dependency 'rake', '~> 12.0'
30
+ spec.add_development_dependency 'rspec', '~> 3.6'
31
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo_db_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erich Quintero
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-09 00:00:00.000000000 Z
11
+ date: 2017-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid
@@ -45,6 +45,9 @@ dependencies:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.14'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 1.14.6
48
51
  type: :development
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,34 +55,37 @@ dependencies:
52
55
  - - "~>"
53
56
  - !ruby/object:Gem::Version
54
57
  version: '1.14'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 1.14.6
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: rake
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
65
  - - "~>"
60
66
  - !ruby/object:Gem::Version
61
- version: '10.0'
67
+ version: '12.0'
62
68
  type: :development
63
69
  prerelease: false
64
70
  version_requirements: !ruby/object:Gem::Requirement
65
71
  requirements:
66
72
  - - "~>"
67
73
  - !ruby/object:Gem::Version
68
- version: '10.0'
74
+ version: '12.0'
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: rspec
71
77
  requirement: !ruby/object:Gem::Requirement
72
78
  requirements:
73
79
  - - "~>"
74
80
  - !ruby/object:Gem::Version
75
- version: '3.0'
81
+ version: '3.6'
76
82
  type: :development
77
83
  prerelease: false
78
84
  version_requirements: !ruby/object:Gem::Requirement
79
85
  requirements:
80
86
  - - "~>"
81
87
  - !ruby/object:Gem::Version
82
- version: '3.0'
88
+ version: '3.6'
83
89
  description:
84
90
  email:
85
91
  - qbantek@gmail.com