Taboola metadata cache¶
TaboolaCampaign.get_campaign() enriches each campaign with creatives and
audience/targeting data via several per-campaign HTTP calls. That metadata
changes slowly, so it is cached in Redis (via redis_settings on the provider)
gated on a per-campaign change fingerprint: an hourly run re-enriches only
campaigns that actually changed. Cost/clicks/revenue are pulled fresh every run
and are never cached.
Entries expire after at most 24 hours. Any Redis error degrades silently to a live fetch, so the cache cannot fail a sync.
Disable cache for one run¶
Force full enrichment (no reads or writes):
export SPAPI_TABOOLA_META_CACHE_DISABLED=1
Accepts 1 / true / yes (case-insensitive).
Clear cached entries¶
After a Taboola data correction or suspected bad sync, clear Redis keys.
Provide redis settings as JSON in SPAPI_REDIS_SETTINGS; deletion requires
--account <id> or --all:
SPAPI_REDIS_SETTINGS='{"host": "localhost", "port": 6379}' \
python -m spapi.scripts.taboola_meta_cache clear --account 48
SPAPI_REDIS_SETTINGS='{"startup_nodes": [{"host": "...", "port": 6379}]}' \
python -m spapi.scripts.taboola_meta_cache clear --all
Schema versioning¶
Cached payload shape is versioned by CACHE_SCHEMA_VERSION in
spapi/helpers/taboola_meta_cache.py. Bumping that integer orphans every old
entry globally without a manual flush.