 kublai.use express.logger('dev') 
 #kublai.use(require('less-middleware')({ src: './public/style' }))
 kublai.use express.static('./public')
-client = redis.createClient 10896,'dory.redistogo.com'
-client.auth 'c6ce6017ecd73bdbcbc23b1a1838919f'
+client = redis.createClient(10896,'dory.redistogo.com')
+client.auth('c6ce6017ecd73bdbcbc23b1a1838919f')
 
 #kublai.set 'json spaces',0
 kublai.get '/data/:year/:set/counties/:tables', (req,res)->
 	res.header "Access-Control-Allow-Origin", "*"
 	res.header "Access-Control-Allow-Headers", "X-Requested-With"
-	client.get req.params.tables, (err,tables)->
+	client.hget req.params.year+req.params.set,req.params.tables, (err,tables)->
 		if tables
 			res.jsonp(JSON.parse(tables))
 		else

	model = models.filter((m)->
		return m.name==key)[0]
	#console.log model
	client.get key, (err,data)->
		if data
			res.jsonp(JSON.parse(data))
		else

				qs:qs
				json:true
			},(e,r,b)->
				client.hset req.params.year+req.params.set,req.params.tables, JSON.stringify(b)
				res.jsonp b
kublai.get '/data/:view', (req,res)->
	res.header "Access-Control-Allow-Origin", "*"
