Commit ed9b544e authored by antirez's avatar antirez
Browse files

first commit

parents
require 'benchmark'
$:.push File.join(File.dirname(__FILE__), 'lib')
require 'redis'
times = 20000
@r = Redis.new
(0..1000000).each{|x|
@r[x] = "Hello World"
puts x if (x > 0 and x % 10000) == 0
}
#--
# = timeout.rb
#
# execution timeout
#
# = Copyright
#
# Copyright - (C) 2008 Evan Phoenix
# Copyright:: (C) 2000 Network Applied Communication Laboratory, Inc.
# Copyright:: (C) 2000 Information-technology Promotion Agency, Japan
#
#++
#
# = Description
#
# A way of performing a potentially long-running operation in a thread, and
# terminating it's execution if it hasn't finished within fixed amount of
# time.
#
# Previous versions of timeout didn't use a module for namespace. This version
# provides both Timeout.timeout, and a backwards-compatible #timeout.
#
# = Synopsis
#
# require 'timeout'
# status = Timeout::timeout(5) {
# # Something that should be interrupted if it takes too much time...
# }
#
require 'thread'
module Timeout
##
# Raised by Timeout#timeout when the block times out.
class Error<Interrupt
end
# A mutex to protect @requests
@mutex = Mutex.new
# All the outstanding TimeoutRequests
@requests = []
# Represents +thr+ asking for it to be timeout at in +secs+
# seconds. At timeout, raise +exc+.
class TimeoutRequest
def initialize(secs, thr, exc)
@left = secs
@thread = thr
@exception = exc
end
attr_reader :thread, :left
# Called because +time+ seconds have gone by. Returns
# true if the request has no more time left to run.
def elapsed(time)
@left -= time
@left <= 0
end
# Raise @exception if @thread.
def cancel
if @thread and @thread.alive?
@thread.raise @exception, "execution expired"
end
@left = 0
end
# Abort this request, ie, we don't care about tracking
# the thread anymore.
def abort
@thread = nil
@left = 0
end
end
def self.add_timeout(time, exc)
@controller ||= Thread.new do
while true
if @requests.empty?
sleep
next
end
min = nil
@mutex.synchronize do
min = @requests.min { |a,b| a.left <=> b.left }
end
slept_for = sleep(min.left)
@mutex.synchronize do
@requests.delete_if do |r|
if r.elapsed(slept_for)
r.cancel
true
else
false
end
end
end
end
end
req = TimeoutRequest.new(time, Thread.current, exc)
@mutex.synchronize do
@requests << req
end
@controller.run
return req
end
##
# Executes the method's block. If the block execution terminates before +sec+
# seconds has passed, it returns true. If not, it terminates the execution
# and raises +exception+ (which defaults to Timeout::Error).
#
# Note that this is both a method of module Timeout, so you can 'include
# Timeout' into your classes so they have a #timeout method, as well as a
# module method, so you can call it directly as Timeout.timeout().
def timeout(sec, exception=Error)
return yield if sec == nil or sec.zero?
raise ThreadError, "timeout within critical session" if Thread.critical
req = Timeout.add_timeout sec, exception
begin
yield sec
ensure
req.abort
end
end
module_function :timeout
end
##
# Identical to:
#
# Timeout::timeout(n, e, &block).
#
# Defined for backwards compatibility with earlier versions of timeout.rb, see
# Timeout#timeout.
def timeout(n, e=Timeout::Error, &block) # :nodoc:
Timeout::timeout(n, e, &block)
end
##
# Another name for Timeout::Error, defined for backwards compatibility with
# earlier versions of timeout.rb.
TimeoutError = Timeout::Error # :nodoc:
if __FILE__ == $0
p timeout(5) {
45
}
p timeout(5, TimeoutError) {
45
}
p timeout(nil) {
54
}
p timeout(0) {
54
}
p timeout(5) {
loop {
p 10
sleep 1
}
}
end
require 'redis'
require 'hash_ring'
class DistRedis
attr_reader :ring
def initialize(*servers)
srvs = []
servers.each do |s|
server, port = s.split(':')
srvs << Redis.new(:host => server, :port => port)
end
@ring = HashRing.new srvs
end
def node_for_key(key)
if key =~ /\{(.*)?\}/
key = $1
end
@ring.get_node(key)
end
def add_server(server)
server, port = server.split(':')
@ring.add_node Redis.new(:host => server, :port => port)
end
def method_missing(sym, *args, &blk)
if redis = node_for_key(args.first)
redis.send sym, *args, &blk
else
super
end
end
def keys(glob)
keyz = []
@ring.nodes.each do |red|
keyz.concat red.keys(glob)
end
keyz
end
def save
@ring.nodes.each do |red|
red.save
end
end
def bgsave
@ring.nodes.each do |red|
red.bgsave
end
end
def quit
@ring.nodes.each do |red|
red.quit
end
end
def delete_cloud!
@ring.nodes.each do |red|
red.keys("*").each do |key|
red.delete key
end
end
end
end
if __FILE__ == $0
r = DistRedis.new 'localhost:6379', 'localhost:6380', 'localhost:6381', 'localhost:6382'
r['urmom'] = 'urmom'
r['urdad'] = 'urdad'
r['urmom1'] = 'urmom1'
r['urdad1'] = 'urdad1'
r['urmom2'] = 'urmom2'
r['urdad2'] = 'urdad2'
r['urmom3'] = 'urmom3'
r['urdad3'] = 'urdad3'
p r['urmom']
p r['urdad']
p r['urmom1']
p r['urdad1']
p r['urmom2']
p r['urdad2']
p r['urmom3']
p r['urdad3']
r.push_tail 'listor', 'foo1'
r.push_tail 'listor', 'foo2'
r.push_tail 'listor', 'foo3'
r.push_tail 'listor', 'foo4'
r.push_tail 'listor', 'foo5'
p r.pop_tail 'listor'
p r.pop_tail 'listor'
p r.pop_tail 'listor'
p r.pop_tail 'listor'
p r.pop_tail 'listor'
puts "key distribution:"
r.ring.nodes.each do |red|
p [red.port, red.keys("*")]
end
r.delete_cloud!
p r.keys('*')
end
require 'digest/md5'
class HashRing
attr_reader :ring, :sorted_keys, :replicas, :nodes
# nodes is a list of objects that have a proper to_s representation.
# replicas indicates how many virtual points should be used pr. node,
# replicas are required to improve the distribution.
def initialize(nodes=[], replicas=3)
@replicas = replicas
@ring = {}
@nodes = []
@sorted_keys = []
nodes.each do |node|
add_node(node)
end
end
# Adds a `node` to the hash ring (including a number of replicas).
def add_node(node)
@nodes << node
@replicas.times do |i|
key = gen_key("#{node}:#{i}")
@ring[key] = node
@sorted_keys << key
end
@sorted_keys.sort!
end
def remove_node(node)
@replicas.times do |i|
key = gen_key("#{node}:#{count}")
@ring.delete(key)
@sorted_keys.reject! {|k| k == key}
end
end
# get the node in the hash ring for this key
def get_node(key)
get_node_pos(key)[0]
end
def get_node_pos(key)
return [nil,nil] if @ring.size == 0
key = gen_key(key)
nodes = @sorted_keys
nodes.size.times do |i|
node = nodes[i]
if key <= node
return [@ring[node], i]
end
end
[@ring[nodes[0]], 0]
end
def iter_nodes(key)
return [nil,nil] if @ring.size == 0
node, pos = get_node_pos(key)
@sorted_keys[pos..-1].each do |k|
yield @ring[k]
end
end
def gen_key(key)
key = Digest::MD5.hexdigest(key)
((key[3] << 24) | (key[2] << 16) | (key[1] << 8) | key[0])
end
end
# ring = HashRing.new ['server1', 'server2', 'server3']
# p ring
# #
# p ring.get_node "kjhjkjlkjlkkh"
#
\ No newline at end of file
This diff is collapsed.
require File.dirname(__FILE__) + '/spec_helper'
class Foo
attr_accessor :bar
def initialize(bar)
@bar = bar
end
def ==(other)
@bar == other.bar
end
end
describe "redis" do
before do
@r = Redis.new
@r.select_db(15) # use database 15 for testing so we dont accidentally step on you real data
@r['foo'] = 'bar'
end
after do
@r.keys('*').each {|k| @r.delete k }
end
it "should properly marshall objects" do
class MyFail; def fail; 'it will' end; end
@r['fail'] = MyFail.new
@r['fail'].fail.should == 'it will'
end
it "should be able to GET a key" do
@r['foo'].should == 'bar'
end
it "should be able to SET a key" do
@r['foo'] = 'nik'
@r['foo'].should == 'nik'
end
it "should be able to SETNX(set_unless_exists)" do
@r['foo'] = 'nik'
@r['foo'].should == 'nik'
@r.set_unless_exists 'foo', 'bar'
@r['foo'].should == 'nik'
end
it "should be able to INCR(increment) a key" do
@r.delete('counter')
@r.incr('counter').should == 1
@r.incr('counter').should == 2
@r.incr('counter').should == 3
end
it "should be able to DECR(decrement) a key" do
@r.delete('counter')
@r.incr('counter').should == 1
@r.incr('counter').should == 2
@r.incr('counter').should == 3
@r.decr('counter').should == 2
@r.decr('counter').should == 1
@r.decr('counter').should == 0
end
it "should be able to RANDKEY(return a random key)" do
@r.randkey.should_not be_nil
end
it "should be able to RENAME a key" do
@r.delete 'foo'
@r.delete 'bar'
@r['foo'] = 'hi'
@r.rename! 'foo', 'bar'
@r['bar'].should == 'hi'
end
it "should be able to RENAMENX(rename unless the new key already exists) a key" do
@r.delete 'foo'
@r.delete 'bar'
@r['foo'] = 'hi'
@r['bar'] = 'ohai'
lambda {@r.rename 'foo', 'bar'}.should raise_error(RedisError)
@r['bar'].should == 'ohai'
end
it "should be able to EXISTS(check if key exists)" do
@r['foo'] = 'nik'
@r.key?('foo').should be_true
@r.delete 'foo'
@r.key?('foo').should be_false
end
it "should be able to KEYS(glob for keys)" do
@r.keys("f*").each do |key|
@r.delete key
end
@r['f'] = 'nik'
@r['fo'] = 'nak'
@r['foo'] = 'qux'
@r.keys("f*").sort.should == ['f','fo', 'foo'].sort
end
it "should be able to check the TYPE of a key" do
@r['foo'] = 'nik'
@r.type?('foo').should == "string"
@r.delete 'foo'
@r.type?('foo').should == "none"
end
it "should be able to push to the head of a list" do
@r.push_head "list", 'hello'
@r.push_head "list", 42
@r.type?('list').should == "list"
@r.list_length('list').should == 2
@r.pop_head('list').should == '42'
@r.delete('list')
end
it "should be able to push to the tail of a list" do
@r.push_tail "list", 'hello'
@r.type?('list').should == "list"
@r.list_length('list').should == 1
@r.delete('list')
end
it "should be able to pop the tail of a list" do
@r.push_tail "list", 'hello'
@r.push_tail "list", 'goodbye'
@r.type?('list').should == "list"
@r.list_length('list').should == 2
@r.pop_tail('list').should == 'goodbye'
@r.delete('list')
end
it "should be able to pop the head of a list" do
@r.push_tail "list", 'hello'
@r.push_tail "list", 'goodbye'
@r.type?('list').should == "list"
@r.list_length('list').should == 2
@r.pop_head('list').should == 'hello'
@r.delete('list')
end
it "should be able to get the length of a list" do
@r.push_tail "list", 'hello'
@r.push_tail "list", 'goodbye'
@r.type?('list').should == "list"
@r.list_length('list').should == 2
@r.delete('list')
end
it "should be able to get a range of values from a list" do
@r.push_tail "list", 'hello'
@r.push_tail "list", 'goodbye'
@r.push_tail "list", '1'
@r.push_tail "list", '2'
@r.push_tail "list", '3'
@r.type?('list').should == "list"
@r.list_length('list').should == 5
@r.list_range('list', 2, -1).should == ['1', '2', '3']
@r.delete('list')
end
it "should be able to trim a list" do
@r.push_tail "list", 'hello'
@r.push_tail "list", 'goodbye'
@r.push_tail "list", '1'
@r.push_tail "list", '2'
@r.push_tail "list", '3'
@r.type?('list').should == "list"
@r.list_length('list').should == 5
@r.list_trim 'list', 0, 1
@r.list_length('list').should == 2
@r.list_range('list', 0, -1).should == ['hello', 'goodbye']
@r.delete('list')
end
it "should be able to get a value by indexing into a list" do
@r.push_tail "list", 'hello'
@r.push_tail "list", 'goodbye'
@r.type?('list').should == "list"
@r.list_length('list').should == 2
@r.list_index('list', 1).should == 'goodbye'
@r.delete('list')
end
it "should be able to set a value by indexing into a list" do
@r.push_tail "list", 'hello'
@r.push_tail "list", 'hello'
@r.type?('list').should == "list"
@r.list_length('list').should == 2
@r.list_set('list', 1, 'goodbye').should be_true
@r.list_index('list', 1).should == 'goodbye'
@r.delete('list')
end
it "should be able add members to a set" do
@r.set_add "set", 'key1'
@r.set_add "set", 'key2'
@r.type?('set').should == "set"
@r.set_count('set').should == 2
@r.set_members('set').sort.should == ['key1', 'key2'].sort
@r.delete('set')
end
it "should be able delete members to a set" do
@r.set_add "set", 'key1'
@r.set_add "set", 'key2'
@r.type?('set').should == "set"
@r.set_count('set').should == 2
@r.set_members('set').should == Set.new(['key1', 'key2'])
@r.set_delete('set', 'key1')
@r.set_count('set').should == 1
@r.set_members('set').should == Set.new(['key2'])
@r.delete('set')
end
it "should be able count the members of a set" do
@r.set_add "set", 'key1'
@r.set_add "set", 'key2'
@r.type?('set').should == "set"
@r.set_count('set').should == 2
@r.delete('set')
end
it "should be able test for set membership" do
@r.set_add "set", 'key1'
@r.set_add "set", 'key2'
@r.type?('set').should == "set"
@r.set_count('set').should == 2
@r.set_member?('set', 'key1').should be_true
@r.set_member?('set', 'key2').should be_true
@r.set_member?('set', 'notthere').should be_false
@r.delete('set')
end
it "should be able to do set intersection" do
@r.set_add "set", 'key1'
@r.set_add "set", 'key2'
@r.set_add "set2", 'key2'
@r.set_intersect('set', 'set2').should == Set.new(['key2'])
@r.delete('set')
end
it "should be able to do set intersection and store the results in a key" do
@r.set_add "set", 'key1'
@r.set_add "set", 'key2'
@r.set_add "set2", 'key2'
@r.set_inter_store('newone', 'set', 'set2')
@r.set_members('newone').should == Set.new(['key2'])
@r.delete('set')
end
it "should be able to do crazy SORT queries" do
@r['dog_1'] = 'louie'
@r.push_tail 'dogs', 1
@r['dog_2'] = 'lucy'
@r.push_tail 'dogs', 2
@r['dog_3'] = 'max'
@r.push_tail 'dogs', 3
@r['dog_4'] = 'taj'
@r.push_tail 'dogs', 4
@r.sort('dogs', :get => 'dog_*', :limit => [0,1]).should == ['louie']
@r.sort('dogs', :get => 'dog_*', :limit => [0,1], :order => 'desc alpha').should == ['taj']
end
end
\ No newline at end of file
require 'rubygems'
$TESTING=true
$:.push File.join(File.dirname(__FILE__), '..', 'lib')
require 'redis'
# Inspired by rabbitmq.rake the Redbox project at http://github.com/rick/redbox/tree/master
require 'fileutils'
class RedisRunner
def self.redisdir
"/tmp/redis/"
end
def self.redisconfdir
'/etc/redis.conf'
end
def self.dtach_socket
'/tmp/redis.dtach'
end
# Just check for existance of dtach socket
def self.running?
File.exists? dtach_socket
end
def self.start
puts 'Detach with Ctrl+\ Re-attach with rake redis:attach'
sleep 3
exec "dtach -A #{dtach_socket} redis-server #{redisconfdir}"
end
def self.attach
exec "dtach -a #{dtach_socket}"
end
def self.stop
sh 'killall redis-server'
end
end
namespace :redis do
desc 'About redis'
task :about do
puts "\nSee http://code.google.com/p/redis/ for information about redis.\n\n"
end
desc 'Start redis'
task :start do
RedisRunner.start
end
desc 'Stop redis'
task :stop do
RedisRunner.stop
end
desc 'Attach to redis dtach socket'
task :attach do
RedisRunner.attach
end
desc 'Install the lastest redis from svn'
task :install => [:about, :download, :make] do
sh 'sudo cp /tmp/redis/redis-server /usr/bin/'
sh 'sudo cp /tmp/redis/redis-benchmark /usr/bin/'
puts 'Installed redis-server and redis-benchmark to /usr/bin/'
unless File.exists?('/etc/redis.conf')
sh 'sudo cp /tmp/redis/redis.conf /etc/'
puts "Installed redis.conf to /etc/ \n You should look at this file!"
end
end
task :make do
sh "cd #{RedisRunner.redisdir} && make clean"
sh "cd #{RedisRunner.redisdir} && make"
end
desc "Download package"
task :download do
system 'svn checkout http://redis.googlecode.com/svn/trunk /tmp/redis' unless File.exists?(RedisRunner.redisdir)
system 'svn up' if File.exists?("#{RedisRunner.redisdir}/.svn")
end
end
namespace :dtach do
desc 'About dtach'
task :about do
puts "\nSee http://dtach.sourceforge.net/ for information about dtach.\n\n"
end
desc 'Install dtach 0.8 from source'
task :install => [:about] do
Dir.chdir('/tmp/')
unless File.exists?('/tmp/dtach-0.8.tar.gz')
require 'net/http'
Net::HTTP.start('superb-west.dl.sourceforge.net') do |http|
resp = http.get('/sourceforge/dtach/dtach-0.8.tar.gz')
open('/tmp/dtach-0.8.tar.gz', 'wb') do |file| file.write(resp.body) end
end
end
unless File.directory?('/tmp/dtach-0.8')
system('tar xzf dtach-0.8.tar.gz')
end
Dir.chdir('/tmp/dtach-0.8/')
sh 'cd /tmp/dtach-0.8/ && ./configure && make'
sh 'sudo cp /tmp/dtach-0.8/dtach /usr/bin/'
puts 'Dtach successfully installed to /usr/bin.'
end
end
\ No newline at end of file
This diff is collapsed.
/* Hash Tables Implementation.
*
* This file implements in memory hash tables with insert/del/replace/find/
* get-random-element operations. Hash tables will auto resize if needed
* tables of power of two in size are used, collisions are handled by
* chaining. See the source code for more information... :)
*
* Copyright (c) 2006-2009, Salvatore Sanfilippo <antirez at gmail dot com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Redis nor the names of its contributors may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __DICT_H
#define __DICT_H
#define DICT_OK 0
#define DICT_ERR 1
/* Unused arguments generate annoying warnings... */
#define DICT_NOTUSED(V) ((void) V)
typedef struct dictEntry {
void *key;
void *val;
struct dictEntry *next;
} dictEntry;
typedef struct dictType {
unsigned int (*hashFunction)(const void *key);
void *(*keyDup)(void *privdata, const void *key);
void *(*valDup)(void *privdata, const void *obj);
int (*keyCompare)(void *privdata, const void *key1, const void *key2);
void (*keyDestructor)(void *privdata, void *key);
void (*valDestructor)(void *privdata, void *obj);
} dictType;
typedef struct dict {
dictEntry **table;
dictType *type;
unsigned int size;
unsigned int sizemask;
unsigned int used;
void *privdata;
} dict;
typedef struct dictIterator {
dict *ht;
int index;
dictEntry *entry, *nextEntry;
} dictIterator;
/* This is the initial size of every hash table */
#define DICT_HT_INITIAL_SIZE 16
/* ------------------------------- Macros ------------------------------------*/
#define dictFreeEntryVal(ht, entry) \
if ((ht)->type->valDestructor) \
(ht)->type->valDestructor((ht)->privdata, (entry)->val)
#define dictSetHashVal(ht, entry, _val_) do { \
if ((ht)->type->valDup) \
entry->val = (ht)->type->valDup((ht)->privdata, _val_); \
else \
entry->val = (_val_); \
} while(0)
#define dictFreeEntryKey(ht, entry) \
if ((ht)->type->keyDestructor) \
(ht)->type->keyDestructor((ht)->privdata, (entry)->key)
#define dictSetHashKey(ht, entry, _key_) do { \
if ((ht)->type->keyDup) \
entry->key = (ht)->type->keyDup((ht)->privdata, _key_); \
else \
entry->key = (_key_); \
} while(0)
#define dictCompareHashKeys(ht, key1, key2) \
(((ht)->type->keyCompare) ? \
(ht)->type->keyCompare((ht)->privdata, key1, key2) : \
(key1) == (key2))
#define dictHashKey(ht, key) (ht)->type->hashFunction(key)
#define dictGetEntryKey(he) ((he)->key)
#define dictGetEntryVal(he) ((he)->val)
#define dictGetHashTableSize(ht) ((ht)->size)
#define dictGetHashTableUsed(ht) ((ht)->used)
/* API */
dict *dictCreate(dictType *type, void *privDataPtr);
int dictExpand(dict *ht, unsigned int size);
int dictAdd(dict *ht, void *key, void *val);
int dictReplace(dict *ht, void *key, void *val);
int dictDelete(dict *ht, const void *key);
int dictDeleteNoFree(dict *ht, const void *key);
void dictRelease(dict *ht);
dictEntry * dictFind(dict *ht, const void *key);
int dictResize(dict *ht);
dictIterator *dictGetIterator(dict *ht);
dictEntry *dictNext(dictIterator *iter);
void dictReleaseIterator(dictIterator *iter);
dictEntry *dictGetRandomKey(dict *ht);
void dictPrintStats(dict *ht);
unsigned int dictGenHashFunction(const unsigned char *buf, int len);
void dictEmpty(dict *ht);
/* Hash table types */
extern dictType dictTypeHeapStringCopyKey;
extern dictType dictTypeHeapStrings;
extern dictType dictTypeHeapStringCopyKeyValue;
#endif /* __DICT_H */
This diff is collapsed.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<link type="text/css" rel="stylesheet" href="style.css" />
</head>
<body>
<div id="page">
<div id='header'>
<a href="index.html">
<img style="border:none" alt="Redis Documentation" src="redis.png">
</a>
</div>
<div id="pagecontent">
<div class="index">
<!-- This is a (PRE) block. Make sure it's left aligned or your toc title will be off. -->
<b>BgsaveCommand: Contents</b><br>&nbsp;&nbsp;<a href="#BGSAVE">BGSAVE</a><br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#Return value">Return value</a><br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#See also">See also</a>
</div>
<h1 class="wikiname">BgsaveCommand</h1>
<div class="summary">
</div>
<div class="narrow">
<h1><a name="BGSAVE">BGSAVE</a></h1>
<blockquote>Save the DB in background. The OK code is immediately returned.Redis forks, the parent continues to server the clients, the childsaves the DB on disk then exit. A client my be able to check if theoperation succeeded using the <a href="LastsaveCommand.html">LASTSAVE</a> command.</blockquote>
<h2><a name="Return value">Return value</a></h2><a href="ReplyTypes.html">Status code reply</a><h2><a name="See also">See also</a></h2>
<ul><li> <a href="SaveCommand.html">SAVE</a></li><li> <a href="ShutdownCommand.html">SHUTDOWN</a></li></ul>
</div>
</div>
</div>
</body>
</html>
This diff is collapsed.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<link type="text/css" rel="stylesheet" href="style.css" />
</head>
<body>
<div id="page">
<div id='header'>
<a href="index.html">
<img style="border:none" alt="Redis Documentation" src="redis.png">
</a>
</div>
<div id="pagecontent">
<div class="index">
<!-- This is a (PRE) block. Make sure it's left aligned or your toc title will be off. -->
<b>Credits: Contents</b><br>&nbsp;&nbsp;<a href="#Credits">Credits</a>
</div>
<h1 class="wikiname">Credits</h1>
<div class="summary">
</div>
<div class="narrow">
<h1><a name="Credits">Credits</a></h1><ul><li> The Redis server was designed and written by <a href="http://invece.org" target="_blank">Salvatore Sanfilippo (aka antirez)</a></li><li> The Ruby client library was written by <a href="http://brainspl.at/" target="_blank">Ezra Zygmuntowicz (aka ezmobius)</a></li><li> The Python and PHP client libraries were written by <a href="http://qix.it" target="_blank">Ludovico Magnocavallo (aka ludo)</a></li><li> The Erlang client library was written by <a href="http://www.adroll.com/" target="_blank">Valentino Volonghi of Adroll</a></li><li> <b>brettbender</b> found and fixed a but in sds.c that caused the server to crash at least on 64 bit systems, and anyway to be buggy since we used the same vararg thing against vsprintf without to call va_start and va_end every time.</li></ul>
</div>
</div>
</div>
</body>
</html>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment