server/olcache.js
function evict(newId){
		//var oldestIndex = first
		//if(oldestIndex === -1) oldestIndex = CACHE_SIZE-1
		
		var evictedId = order[first]
		
		if(evictedId !== -1){//means it has been destroyed
			// write new version of object
			var edits = cache[evictedId]
			if(edits === undefined) _.errout('cannot evict, bug: ' + evictedId + ' ' + JSON.stringify(order))
			_.assertArray(edits)
			/*if(edits[1].edit.id !== evictedId){
				_.errout(JSON.stringify(edits))
			}
			_.assertEqual(edits[1].edit.id, evictedId)*/
		
			if(ob.isNew(evictedId)){
				ob.write(evictedId, edits)
			}else{
				ob.append(evictedId, edits)
			}
			delete cache[evictedId]
			//console.log('evicted: ' + evictedId)
		}
		
		push(newId)
		
	//	console.log('should be full: ' + JSON.stringify(order))
		/*for(var i=0;i<order.length;++i){
			_.assertInt(order[i])
			_.assert(order[i] !== evictedId)
		}*/
	}
function evict(newId){
		//var oldestIndex = first
		//if(oldestIndex === -1) oldestIndex = CACHE_SIZE-1
		
		var evictedId = order[first]
		
		if(evictedId !== -1){//means it has been destroyed
			// write new version of object
			var edits = cache[evictedId]
			if(edits === undefined) _.errout('cannot evict, bug: ' + evictedId + ' ' + JSON.stringify(order))
			_.assertArray(edits)
			/*if(edits[1].edit.id !== evictedId){
				_.errout(JSON.stringify(edits))
			}
			_.assertEqual(edits[1].edit.id, evictedId)*/
		
			if(ob.isNew(evictedId)){
				ob.write(evictedId, edits)
			}else{
				ob.append(evictedId, edits)
			}
			delete cache[evictedId]
			//console.log('evicted: ' + evictedId)
		}
		
		push(newId)
		
	//	console.log('should be full: ' + JSON.stringify(order))
		/*for(var i=0;i<order.length;++i){
			_.assertInt(order[i])
			_.assert(order[i] !== evictedId)
		}*/
	}
/*var readCache = {}//for reading objects
var readBinaryCache = {}
setInterval(function(){
readCache = {}
readBinaryCache = {}
},5000)