GifService Service
File: src/services/GifService.ts
Overview
Exports
- GifFavorite - interface export
- FavoriteGif - type export
- GifService - class export
- gifService - const export
Classes
GifService
No description available.
Methods:
getInstanceinitializeCachecatchaddFavoriteByUrlremoveFavoriteByUrltoggleFavoriteByUrltoggleFavoriteaddFavoriteremoveFavoritegetFavorites_fetchFavoritesisFavoriteByUrlisFavoriteByUrlAsyncfavoriteToGifclearCache
Properties:
instancelookupsfavoriteUrlscacheInitializedOPTIMIZEDfavoritesCachefavoritesCacheTimependingFavoritesRequestisAuthsupabasecachetrueinitializedURLgifUrlpreviewUrltitlesuccesserrorcontextuser_idgif_urlpreview_urlfavoritescachesrefreshesnullisFavoriteisCurrentlyFavoriteresultmethodremoveFavoriteByUrlsitesGIFsauthvalidnowrequestsDBascendingloadedidmedia_formatsgifgifpreviewfallbacksmp4webmfalse0
Interfaces
GifFavorite
No description available.
typescript
interface GifFavorite {
id: string
user_id: string
gif_url: string
preview_url: string
title: string | null
created_at: string
}Type Definitions
FavoriteGif
No description available.
typescript
export type FavoriteGif = GifFavorite
// Cache TTL: 5 minutes
const CACHE_TTL = 5 * 60 * 1000
export class GifService {
private static instance: GifService
// Local cache of favorite URLs for quick lookups
private favoriteUrls: Set<string> = new Set()
private cacheInitialized = false
// OPTIMIZED: Full favorites cache with TTL
private favoritesCache: FavoriteGif[] | null = null
private favoritesCacheTime = 0
private pendingFavoritesRequest: Promise<FavoriteGif[]> | null =...Constants
CACHE_TTL
No description available.
typescript
const CACHE_TTL = 5 * 60 * 1000Source Code Insights
File Size: 9723 characters Lines of Code: 325 Imports: 4
Usage Example
typescript
import { GifFavorite, FavoriteGif, GifService, gifService } from '@/services/GifService'
// Example usage
// Use the exported functionalityThis documentation was automatically generated from the source code.
