How to use the @wora/cache-persist function in @wora/cache-persist

To help you get started, we’ve selected a few @wora/cache-persist examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github morrys / wora / packages / cache-persist / examples / react-example / src / index.tsx View on Github external
console.log(idbStorages);

const CacheLocalIDBNO = new Cache({
    prefix: null,
    serialize: false,
    storage: idbStorageNo[0],
});

const CacheLocalIDB = new Cache({
    layers: [filterNoPersistReplace],
    serialize: false,
    storage: idbStorages[0],
});


const CacheLocalIDB2 = new Cache({
    layers: [filterPersistReplace],
    serialize: false,
    storage: idbStorages[1],
});

const CacheLocalDisable = new Cache({
    disablePersist: true
});


const App = () => {
    return
github morrys / wora / packages / cache-persist / examples / react-example / src / index.tsx View on Github external
const StyledApp = styled.div`
    display: flex;
    justify-content: center;
    flex-direction: column-reverse;
`;

const filterPersistReplace: ILayer = filterKeys(key => key.includes("replace"));

const filterNoPersistReplace: ILayer = filterKeys(key => !key.includes("replace"));

const CacheLocal = new Cache({
    layers: [filterNoPersistReplace],
});

const CacheLocalNew = new Cache({
    errorHandling: (error) => { 
        console.log("error", error);
        return true;
    },
    layers: [filterPersistReplace],
    prefix: 'cachenew',
});

const CacheSessionNew = new Cache({
    prefix: 'cachenew',
    webStorage: 'session'
});

const idbStorages: CacheStorage[] = IDBStorage.create( {
    name: "cache",
    onUpgrade: (db, oldv, newv, transaction) => {
github morrys / wora / packages / cache-persist / examples / react-example / src / index.tsx View on Github external
const filterNoPersistReplace: ILayer = filterKeys(key => !key.includes("replace"));

const CacheLocal = new Cache({
    layers: [filterNoPersistReplace],
});

const CacheLocalNew = new Cache({
    errorHandling: (error) => { 
        console.log("error", error);
        return true;
    },
    layers: [filterPersistReplace],
    prefix: 'cachenew',
});

const CacheSessionNew = new Cache({
    prefix: 'cachenew',
    webStorage: 'session'
});

const idbStorages: CacheStorage[] = IDBStorage.create( {
    name: "cache",
    onUpgrade: (db, oldv, newv, transaction) => { 
        console.log("onUpgrade", db, oldv, newv, transaction);
    }, 
    storeNames: ["persist", "persist2"],
    version: 1,
    
});

const idbStorageNo: CacheStorage[] = IDBStorage.create( {
    name: "nocache",
github morrys / wora / packages / cache-persist / examples / react-example / src / index.tsx View on Github external
-moz-osx-font-smoothing: grayscale;
    font-weight: 300;
  }
  `

const StyledApp = styled.div`
    display: flex;
    justify-content: center;
    flex-direction: column-reverse;
`;

const filterPersistReplace: ILayer = filterKeys(key => key.includes("replace"));

const filterNoPersistReplace: ILayer = filterKeys(key => !key.includes("replace"));

const CacheLocal = new Cache({
    layers: [filterNoPersistReplace],
});

const CacheLocalNew = new Cache({
    errorHandling: (error) => { 
        console.log("error", error);
        return true;
    },
    layers: [filterPersistReplace],
    prefix: 'cachenew',
});

const CacheSessionNew = new Cache({
    prefix: 'cachenew',
    webStorage: 'session'
});
github morrys / wora / packages / cache-persist / examples / react-example / src / index.tsx View on Github external
storeNames: ["persist"],
    version: 1,
    
});

console.log(idbStorages[0]);

console.log(idbStorages);

const CacheLocalIDBNO = new Cache({
    prefix: null,
    serialize: false,
    storage: idbStorageNo[0],
});

const CacheLocalIDB = new Cache({
    layers: [filterNoPersistReplace],
    serialize: false,
    storage: idbStorages[0],
});


const CacheLocalIDB2 = new Cache({
    layers: [filterPersistReplace],
    serialize: false,
    storage: idbStorages[1],
});

const CacheLocalDisable = new Cache({
    disablePersist: true
});
github morrys / offline-examples / apollo / todo / client / src / apollo / OfflineStore.js View on Github external
serialize: true,
            ...persistOptions,
            ...persistOptionsOptimistics,
        }
        const idbStorages: CacheStorage[] = IDBStorage.create("relay", ["roots", "cache"]);
        const idb: CacheOptions = {
          storage: idbStorages[0],
          serialize: false,
        }
        
        const idb1: CacheOptions = {
          storage: idbStorages[1],
          serialize: false,
        }*/

        this.cache = new Cache(persistOptions);
    }
github morrys / react-relay-offline / src / runtime / Store.ts View on Github external
...persistOptionsRecords,
    }
    /*const idbStorages: CacheStorage[] = IDBStorage.create("relay", ["roots", "cache"]);
    const idb: CacheOptions = {
      storage: idbStorages[0],
      serialize: false,
    }
    
    const idb1: CacheOptions = {
      storage: idbStorages[1],
      serialize: false,
    }*/


    const cacheRecordSource = new Cache(persistOptionsRecordSource);
    const cache = new Cache(persistOptionsStore);


    this._recordSource = new RecordSource(cacheRecordSource);

    this._cache = cache;
  }
github morrys / react-relay-offline / src / runtime / Store.ts View on Github external
...persistOptions,
      ...persistOptionsRecords,
    }
    /*const idbStorages: CacheStorage[] = IDBStorage.create("relay", ["roots", "cache"]);
    const idb: CacheOptions = {
      storage: idbStorages[0],
      serialize: false,
    }
    
    const idb1: CacheOptions = {
      storage: idbStorages[1],
      serialize: false,
    }*/


    const cacheRecordSource = new Cache(persistOptionsRecordSource);
    const cache = new Cache(persistOptionsStore);


    this._recordSource = new RecordSource(cacheRecordSource);

    this._cache = cache;
  }
github morrys / wora / packages / apollo-cache / src / index.ts View on Github external
constructor(options: InMemoryCacheConfig = {}, persistOptions: CacheOptions = {}) {
        super(options);
        const persistOptionsApollo = {
            prefix: 'apollo-cache',
            serialize: true,
            ...persistOptions,
        };
        this.cache = new Cache(persistOptionsApollo);
        (this.cache as any).toObject = (): Readonly<{
            [key: string]: any;
        }> => this.cache.getState();
        (this.cache as any).clear = (): void => this.cache.purge();
        (this as any).data = this.cache;
        (this as any).optimisticData = this.cache;
    }
github morrys / wora / packages / cache-persist / examples / react-example / src / index.tsx View on Github external
});

const CacheLocalIDB = new Cache({
    layers: [filterNoPersistReplace],
    serialize: false,
    storage: idbStorages[0],
});


const CacheLocalIDB2 = new Cache({
    layers: [filterPersistReplace],
    serialize: false,
    storage: idbStorages[1],
});

const CacheLocalDisable = new Cache({
    disablePersist: true
});


const App = () => {
    return 
            
            
            
            
            
            
            
         
}