Supabase.Storage.CacheReloader (supabase_storage v0.2.0)

Periodically reloads and updates the bucket cache for Supabase Storage.

This module acts as a GenServer that schedules periodic tasks to reload and update the cache for Supabase Storage Buckets. It collaborates with the Supabase.Storage.Cache to ensure that the cached data remains fresh and updated.

Features

  • Automatic Cache Reloading: Periodically reloads the buckets from Supabase Storage and updates the cache.
  • Configurable Reload Interval: The time interval between successive cache reloads can be specified.

Usage

Starting the CacheReloader Server

Supabase.Storage.CacheReloader.start_link(%{reload_interval: 2_000})

Implementation Details

By default, the reload interval is set to 1 second (@ttl). This means the cache will be updated every second with the latest data from Supabase Storage. This interval can be configured during the server start using the :reload_interval option.

The server interacts with Supabase.Storage.list_buckets/1 to fetch the list of buckets and then updates the cache using Supabase.Storage.Cache.cache_buckets/1.

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

Link to this function

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

start_link(args)