Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 37 lines (29 sloc) 0.799 kb
#!/usr/bin/ruby
#
# construct the blocklist in memcache for testing
#
# for use with memcache-client 1.5.x
require 'rubygems'
require 'memcache'
@servers = [ 'localhost:11211' ]
@options = {
:prefix_key => '',
:hash => :default,
:distribution => :modula
}
@cache = MemCache.new(@servers,@options)
#
# per robey: marshall must be set to false otherwise we'll feed marshalled data to apache
# and apache doesn't work with marshalled data.
#
@cache.set("mb:b:1",'127.0.0.0-127.0.0.99',0,true)
@cache.set("mb:b:2",'127.0.0.0/24',0,true)
@cache.set("mb:b:3",'127.0.0.1',0,true)
# ipv6
@cache.set("mb:b:4",'::1',0,true)
# whitelisting - takes precendence
# @cache.set("mb:w:4",'::1',0,true)
puts "blocks set:"
for x in 1..4
puts "#{x} = " + @cache.get("mb:b:#{x}",true)
end
Jump to Line
Something went wrong with that request. Please try again.