forgot to add redis.js

v1.18.x
psychobunny 12 years ago
parent efa0649081
commit ccc57b0d71

@ -29,9 +29,9 @@
templates_init();
var rootUrl = document.location.protocol + '//' + (document.location.hostname || document.location.host),
var rootUrl = document.location.protocol + '//' + (document.location.hostname || document.location.host) + (document.location.port ? ':'+document.location.port : ''),
content = null;
console.log(rootUrl);
$('document').ready(function() {
if (!window.history || !window.history.pushState) return; // no ajaxification for old browsers

@ -0,0 +1,59 @@
(function(RedisDB) {
var PRODUCTION = false,
ERROR_LOGS = true,
redis = require('redis'),
db = redis.createClient();
// todo (holy cow): append,auth,bgrewriteaof,bgsave,bitcount,bitop,blpop,brpop,brpoplpush,client kill,client list,client getname,client setname,config get,config set,config resetstat,dbsize,debug object,debug segfault,decrby,del,discard,dump,echo,eval,evalsha,exec,exists,expire,expireat,flushall,flushdb,getbit,getrange,getset,hdel,hexists,hget,hgetall,hincrby,hincrbyfloat,hkeys,hlen,hmget,hmset,hset,hsetnx,hvals,incrby,incrbyfloat,info,keys,lastsave,lindex,linsert,llen,lpop,lpush,lpushx,lrange,lrem,lset,ltrim,mget,migrate,monitor,move,mset,msetnx,multi,object,persist,pexpire,pexpireat,ping,psetex,psubscribe,pttl,publish,punsubscribe,quit,randomkey,rename,renamenx,restore,rpop,rpoplpush,rpush,rpushx,sadd,save,scard,script exists,script flush,script kill,script load,sdiff,sdiffstore,select,setbit,setex,setnx,setrange,shutdown,sinter,sinterstore,sismember,slaveof,slowlog,smembers,smove,sort,spop,srandmember,srem,strlen,subscribe,sunion,sunionstore,sync,time,ttl,type,unsubscribe,unwatch,watch,zadd,zcard,zcount,zincrby,zinterstore,zrange,zrangebyscore,zrank,zrem,zremrangebyrank,zremrangebyscore,zrevrange,zrevrangebyscore,zrevrank,zscore,zunionstore
// done :^) get, set, incr, decr
function return_handler(error, data, callback, error_handler) {
if (error !== null) {
if (error_handler !== null) {
error_handler(error);
} else if (PRODUCTION === false) {
throw new Exception('RedisDB Error: ' + error);
} else if (ERROR_LOGS === true) {
console.log('RedisDB Error: ' + error);
}
} else {
callback(data);
}
}
RedisDB.set = function(key, value) {
db.set(key, value);
};
RedisDB.get = function(key, callback, error_handler) {
db.get(key, function(error, data) {
return_handler(error, data, callback, error_handler);
});
};
// Atomic Operations
RedisDB.incr = function(key, callback, error_handler) {
db.incr(key, function(error, data) {
if (callback) {
return_handler(error, data, callback, error_handler);
}
});
};
RedisDB.decr = function(key) {
db.decr(key);
};
// Lists
RedisDB.lpush = function(key, item) {
db.lpush(key, item);
}
RedisDB.lrange = function(key, start, end, callback, error_handler) {
db.lrange(key, start, end, function(error, data) {
return_handler(error, data, callback, error_handler);
});
}
}(exports));

@ -46,7 +46,7 @@ var express = require('express'),
});
});
app.listen(80);
app.listen(4567);
}
}(WebServer));

Loading…
Cancel
Save