"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * Notifies all caches to delete data at the specified key.
 * @param key the key to delete
 * @returns A promise that resolves as soon as the del notification is sent. Since regional caches are
 *  eventually consisten, this may return before every cache is updated.
 */
async function del(key) {
    return new Promise(function globalDelPromise(resolve, reject) {
        bridge.dispatch("flyCacheNotify", "del", key, function globalDelCallback(err, ok) {
            if (err != null) {
                reject(err);
                return;
            }
            resolve(ok);
        });
    });
}
exports.del = del;
/**
 * Notifies all regional caches to purge keys with the specified tag.
 * @param tag the tag to purge
 * @returns A promise that resolves as soon as the purge notification is sent. Since regional caches are
 *  eventually consisten, this may return before every cache is updated.
 */
async function purgeTag(tag) {
    return new Promise(function globalDelPromise(resolve, reject) {
        bridge.dispatch("flyCacheNotify", "purgeTag", tag, function globalPurgeTagCallback(err, ok) {
            if (err != null) {
                reject(err);
                return;
            }
            resolve(ok);
        });
    });
}
exports.purgeTag = purgeTag;
exports.default = {
    del,
    purgeTag
};
//# sourceMappingURL=global.js.map