fluent-plugin-storage-redis 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/fluent-plugin-storage-redis.gemspec +1 -1
- data/lib/fluent/plugin/storage_redis.rb +8 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45c036a2d960d3cc7bedda93dce3a318da12504c
|
4
|
+
data.tar.gz: 900f4668a055d960564ca5737d582cb5c0b47778
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2dfab51e61bcce2948dee8b39bd42ada4cda5fcd9d5c2f2073903e6809c12de3b0850ccf2c8d5d3ad822d735f6f56cbdc17cce65520816f2dd328ab739f0bd46
|
7
|
+
data.tar.gz: 829a1e1202262ed7994edb0528336f7f67039cc88a4278a390f542561bb2df6272acdb229192597dde6b173d5bb64bebba6ab92200f867fda22e4aeaaaf916d0
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "fluent-plugin-storage-redis"
|
7
|
-
spec.version = "0.0.
|
7
|
+
spec.version = "0.0.4"
|
8
8
|
spec.authors = ["Hiroshi Hatake"]
|
9
9
|
spec.email = ["cosmo0920.oucc@gmail.com"]
|
10
10
|
|
@@ -6,11 +6,14 @@ module Fluent
|
|
6
6
|
class RedisStorage < Storage
|
7
7
|
Fluent::Plugin.register_storage('redis', self)
|
8
8
|
|
9
|
+
DEFAULT_TTL_VALUE = -1
|
10
|
+
|
9
11
|
config_param :path, :string, default: nil
|
10
12
|
config_param :host, :string, default: 'localhost'
|
11
13
|
config_param :port, :integer, default: 6379
|
12
14
|
config_param :db_number, :integer, default: 0
|
13
15
|
config_param :password, :string, default: nil, secret: true
|
16
|
+
config_param :ttl, :integer, default: DEFAULT_TTL_VALUE
|
14
17
|
# Set persistent true by default
|
15
18
|
config_set_default :persistent, true
|
16
19
|
|
@@ -66,6 +69,7 @@ module Fluent
|
|
66
69
|
def load
|
67
70
|
begin
|
68
71
|
json_string = @redis.get(@path)
|
72
|
+
json_string ||= "{}" # for ttl support.
|
69
73
|
json = Yajl::Parser.parse(json_string)
|
70
74
|
unless json.is_a?(Hash)
|
71
75
|
log.error "broken content for plugin storage (Hash required: ignored)", type: json.class
|
@@ -82,7 +86,10 @@ module Fluent
|
|
82
86
|
begin
|
83
87
|
json_string = Yajl::Encoder.encode(@store)
|
84
88
|
@redis.pipelined {
|
85
|
-
@redis.
|
89
|
+
@redis.multi do
|
90
|
+
@redis.set(@path, json_string)
|
91
|
+
@redis.expire(@path, @ttl) if @ttl > 0
|
92
|
+
end
|
86
93
|
}
|
87
94
|
rescue => e
|
88
95
|
log.error "failed to save data for plugin storage to redis", path: @path, error: e
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-storage-redis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroshi Hatake
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|