Files
jrshikoku/storageConfig.ts
harukin-expo-dev-env 84403ea89d 暫定保存
2025-12-05 07:34:44 +00:00

31 lines
924 B
TypeScript

import Storage from "react-native-storage";
import AsyncStorage from "@react-native-async-storage/async-storage";
// ストレージ最大容量
const STORAGE_MAX_SIZE = 10000;
const storage = new Storage({
// maximum capacity, default 1000 key-ids
size: STORAGE_MAX_SIZE,
// Use AsyncStorage for RN apps, or window.localStorage for web apps.
// If storageBackend is not set, data will be lost after reload.
storageBackend: AsyncStorage, // for web: window.localStorage
// expire time, default: 1 day (1000 * 3600 * 24 milliseconds).
// can be null, which means never expire.
defaultExpires: null,
// cache data in the memory. default is true.
enableCache: true,
// if data was not found in storage or expired data was found,
// the corresponding sync method will be invoked returning
// the latest data.
sync: {
// we'll talk about the details later.
},
});
export default storage;