Class: LogStash::Filters::Memcached

Inherits:
Base
  • Object
show all
Defined in:
lib/logstash/filters/memcached.rb

Overview

This filter provides facilities to interact with Memcached.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cacheObject (readonly)

Returns the value of attribute cache.



72
73
74
# File 'lib/logstash/filters/memcached.rb', line 72

def cache
  @cache
end

Instance Method Details

#closeObject

def filter



90
91
92
# File 'lib/logstash/filters/memcached.rb', line 90

def close
  cache.close
end

#filter(event) ⇒ Object

def register



83
84
85
86
87
88
# File 'lib/logstash/filters/memcached.rb', line 83

def filter(event)
  set_success = do_set(event)
  get_success = do_get(event)

  filter_matched(event) if (set_success || get_success)
end

#registerObject



74
75
76
77
78
79
80
81
# File 'lib/logstash/filters/memcached.rb', line 74

def register
  if @ttl < 0
    logger.error("ttl cannot be negative")
    fail("invalid ttl: cannot be negative")
  end

  @cache = establish_connection
end