瀏覽代碼

Add Redis getter

Jake 10 年之前
父節點
當前提交
5a4643f334
共有 2 個文件被更改,包括 6 次插入2 次删除
  1. 4 0
      modules/cache.js
  2. 2 2
      test/test.js

+ 4 - 0
modules/cache.js

@@ -25,6 +25,10 @@ function connect_redis() {
 
 
 var exp = {};
 var exp = {};
 
 
+exp.get_redis = function() {
+  return redis;
+};
+
 // sets the timestamp for +uuid+ to now
 // sets the timestamp for +uuid+ to now
 exp.update_timestamp = function(uuid) {
 exp.update_timestamp = function(uuid) {
   console.log(uuid + " cache: updating timestamp");
   console.log(uuid + " cache: updating timestamp");

+ 2 - 2
test/test.js

@@ -5,7 +5,7 @@ var networking = require('../modules/networking');
 var helpers = require('../modules/helpers');
 var helpers = require('../modules/helpers');
 var config = require('../modules/config');
 var config = require('../modules/config');
 var skins = require('../modules/skins');
 var skins = require('../modules/skins');
-var redis = require("../modules/cache");
+var cache = require("../modules/cache");
 
 
 var uuids = fs.readFileSync('test/uuids.txt').toString().split("\r\n");
 var uuids = fs.readFileSync('test/uuids.txt').toString().split("\r\n");
 // Get a random UUID in order to prevent rate limiting
 // Get a random UUID in order to prevent rate limiting
@@ -13,7 +13,7 @@ var uuid = uuids[Math.floor(Math.random() * uuids.length)];
 
 
 describe('Avatar Serving', function(){
 describe('Avatar Serving', function(){
   before(function() {
   before(function() {
-    redis.flushall();
+    cache.get_redis().flushall();
   });
   });
   describe('UUID', function(){
   describe('UUID', function(){
     it("should be an invalid uuid", function(done){
     it("should be an invalid uuid", function(done){