public Object getObject(String key) {
        Object value = null;
        synchronized (this) {
            if (flushInterval != NO_FLUSH_INTERVAL && System.currentTimeMillis() - lastFlush > flushInterval) {
                flush();
            }
        }
        value = controller.getObject(key);
        if (serialize && !readOnly && (value != NULL_OBJECT && value != null)) {
            try {
                ByteArrayInputStream bis = new ByteArrayInputStream((byte[]) value);
                ObjectInputStream ois = new ObjectInputStream(bis);
                value = ois.readObject();
                ois.close();
            } catch (Exception e) {
                throw new RuntimeException(
                        "Error caching serializable object.  Be sure you're not attempting to use "
                                + "a serialized cache for an object that may be taking advantage of lazy loading.  Cause: "
                                + e, e);
            }
        }
        requests++;
        if (value != null) {
            hits++;
        }
        return value;
    }