convert keys to lower case at cache level

This commit is contained in:
jomo 2014-12-10 18:42:19 +01:00
parent c8d28ed2df
commit 9faeedc03f
3 changed files with 6 additions and 2 deletions

View File

@ -59,6 +59,8 @@ exp.get_redis = function() {
exp.update_timestamp = function(uuid, hash) { exp.update_timestamp = function(uuid, hash) {
logging.log(uuid + " cache: updating timestamp"); logging.log(uuid + " cache: updating timestamp");
var time = new Date().getTime(); var time = new Date().getTime();
// store uuid in lower case if not null
uuid = uuid && uuid.toLowerCase();
redis.hmset(uuid, "t", time); redis.hmset(uuid, "t", time);
update_file_date(hash); update_file_date(hash);
}; };
@ -78,6 +80,8 @@ exp.save_hash = function(uuid, hash) {
// {hash: "0123456789abcdef", time: 1414881524512} // {hash: "0123456789abcdef", time: 1414881524512}
// null when uuid unkown // null when uuid unkown
exp.get_details = function(uuid, callback) { exp.get_details = function(uuid, callback) {
// get uuid in lower case if not null
uuid = uuid && uuid.toLowerCase();
redis.hgetall(uuid, function(err, data) { redis.hgetall(uuid, function(err, data) {
var details = null; var details = null;
if (data) { if (data) {

View File

@ -15,7 +15,7 @@ var human_status = {
/* GET avatar request. */ /* GET avatar request. */
router.get("/:uuid.:ext?", function(req, res) { router.get("/:uuid.:ext?", function(req, res) {
var uuid = (req.params.uuid || "").toLowerCase(); var uuid = (req.params.uuid || "");
var size = parseInt(req.query.size) || config.default_size; var size = parseInt(req.query.size) || config.default_size;
var def = req.query.default; var def = req.query.default;
var helm = req.query.hasOwnProperty("helm"); var helm = req.query.hasOwnProperty("helm");

View File

@ -8,7 +8,7 @@ var lwip = require("lwip");
/* GET skin request. */ /* GET skin request. */
router.get("/:uuid.:ext?", function(req, res) { router.get("/:uuid.:ext?", function(req, res) {
var uuid = (req.params.uuid || "").toLowerCase(); var uuid = (req.params.uuid || "");
var def = req.query.default; var def = req.query.default;
var start = new Date(); var start = new Date();
var etag = null; var etag = null;