public static PyObject GetUserCache(int user, string name) { if (LoadUserCacheFor(user, name) == false) { return null; } // We can assume this will not throw any exception as we've just checked if it exists PyTuple info = userCacheData[user][name]; PyCachedObject obj = new PyCachedObject(); obj.nodeID = info.Items[2].As<PyIntegerVar>().Value; obj.objectID = new PyString(name); obj.shared = 0; obj.compressed = 0; obj.cache = info.Items[0].As<PyBuffer>(); obj.timestamp = info.Items[1].As<PyLongLong>().Value; obj.version = info.Items[3].As<PyIntegerVar>().Value; return obj.Encode(); }
public static PyObject GetCache(string name) { if (LoadCacheFor(name) == false) { return null; } PyTuple info = cacheData[name]; PyCachedObject obj = new PyCachedObject(); obj.nodeID = info.Items[2].As<PyIntegerVar>().Value; obj.objectID = new PyString(name); obj.shared = 0; obj.compressed = 0; obj.cache = info.Items[0].As<PyBuffer>(); obj.timestamp = info.Items[1].As<PyLongLong>().Value; obj.version = info.Items[3].As<PyIntegerVar>().Value; return obj.Encode(); }