function StringCacheStorageUtils(uniqueKey) { this._flagUtils = newBooleanInStorage(uniqueKey + '-flag'); this._stringUtils = newStringInStorage(uniqueKey + '-string'); this.hasValue = function () { return this._flagUtils.get(); }; // true if the cache contains a cached string, false otherwise this.getCachedString = function () { const hasValue = this._flagUtils.get(); if (!hasValue) return ''; return this._stringUtils.get(); }; this.setCachedString = function (stringValue) { this._stringUtils.set(stringValue); this._flagUtils.set(true); }; this.clear = function () { this._flagUtils.set(false); this._stringUtils.set(''); }; }