| 1234567891011121314151617181920212223242526272829303132333435 |
- // import RNDeviceInfo from 'react-native-device-info';
- import RNFS from 'react-native-fs-turbo';
- import { createMMKV, MMKV } from 'react-native-mmkv';
- let globalStorage: MMKV | null = null;
- export function getGlobalStorage() {
- if (!globalStorage) {
- globalStorage = createMMKV({
- id: `global`,
- });
- }
- return globalStorage;
- }
- let caches: MMKV | null = null;
- export function getCaches() {
- if (!caches) {
- caches = createMMKV({
- id: `caches`,
- path: `${RNFS.CachesDirectoryPath}`,
- });
- }
- return caches;
- }
- let apiCache: MMKV | null = null;
- export function getApiCache() {
- if (!apiCache) {
- apiCache = createMMKV({
- id: `api_cache`,
- path: `${RNFS.CachesDirectoryPath}`,
- });
- }
- return apiCache;
- }
|