PHP 8.2.31
Preview: unsplash-cache.js Size: 661 B
/home/nshryvcy/radiantskinclinics.org/wp-content/plugins/extendify_old/src/Shared/state/unsplash-cache.js

import { create } from 'zustand';
import { createJSONStorage, devtools, persist } from 'zustand/middleware';

const ONE_WEEK_IN_MILLISECONDS = 1000 * 60 * 60 * 24 * 7;

const state = (set, get) => ({
	images: [],
	expiration: 0,
	isEmpty: () => get().images.length === 0,
	hasExpired: () => Date.now() > get().expiration,
	updateCache: (images) =>
		set({ images, expiration: Date.now() + ONE_WEEK_IN_MILLISECONDS }),
});

export const useUnsplashCacheStore = create(
	persist(devtools(state, { name: 'Extendify Unsplash Images' }), {
		name: `extendify-unsplash-images-${window.extSharedData.siteId}`,
		storage: createJSONStorage(() => localStorage),
	}),
);

Directory Contents

Dirs: 1 × Files: 5

Name Size Perms Modified Actions
__tests__ DIR
- drwxr-xr-x 2026-04-28 02:40:02
Edit Download
1.22 KB lrw-r--r-- 2026-02-19 03:27:14
Edit Download
1.53 KB lrw-r--r-- 2025-12-17 19:09:10
Edit Download
1.88 KB lrw-r--r-- 2026-02-19 03:27:14
Edit Download
914 B lrw-r--r-- 2026-02-27 04:48:52
Edit Download
661 B lrw-r--r-- 2026-02-19 03:27:14
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).