/**
 * Created by Tony on 2017/5/15.
 */
storageUtil = {
    browserFlag: {isIE: false, isFF: false, isChrome: false, isOpera: false, other: false},
    iniStorage: function() {
        var me = this;
        me.browserFlag.isIE = (!!window.ActiveXObject || "ActiveXObject" in window);
        if (!me.browserFlag.isIE) {
            if (userAgent.indexOf("Firefox") > -1) {
                me.browserFlag.isFF = true;
            } else if (userAgent.indexOf("Chrome") > -1){
                me.browserFlag.isChrome = true;
            } else if (userAgent.indexOf("Opera") > -1) {
                me.browserFlag.isOpera = true;
            } else {
                me.browserFlag.other = true;
            }
        }
    },
    getSessionCache: function(groupKey, itemKey) {
        return sessionStorage[groupKey + "_" + itemKey];
    },
    setSessionCache: function(groupKey, itemKey, value) {
        sessionStorage[groupKey + "_" + itemKey] = value;
    },
    getLocalCache: function(groupKey, itemKey) {
        return localStorage[groupKey + "_" + itemKey];
    },
    setLocalCache: function(groupKey, itemKey, value) {
        localStorage[groupKey + "_" + itemKey] = value;
    },
    clearSessionCache: function(groupKey, itemKey) {
        delete sessionStorage[groupKey + "_" + itemKey];
    }
}
