TSCACHEWRITE(3ts)

πŸ“¦
version 9.2.5 Β· 4 versions
, in ubuntu noble, ubuntu questing

πŸ’– TSCACHEWRITE πŸ’–

okay bestie, gather round, we're doing the Apache Traffic Server thing again, and this one is literally called TSCacheWrite. it lives in section 3ts of the manual, iykyk πŸŽ€


✨ NAME ✨

TSCacheWrite β€” it's the TSCacheWrite API function, no cap, that's the whole name, that's what it does, we move πŸ’…


🌸 SYNOPSIS 🌸

here's the summoning spell, copy it exactly bestie, character for character:

#include <ts/ts.h>

TSAction TSCacheWrite(TSCont contp, TSCacheKey key)

πŸ¦‹ DESCRIPTION πŸ¦‹

so what this does is: it goes up to the Traffic Server cache and is like "hey, can contp start writing the object that corresponds to key?" like it's asking permission, it's giving very polite, very mindful 🫢

if the object CAN be written β€” slay β€” the cache calls contp back with the event TS_EVENT_CACHE_OPEN_WRITE. and get this, in that case the cache also hands contp a cache vconnection, and then contp can initiate a write operation on that vconnection using TSVConnWrite. iconic.

important, bestie: the object is NOT committed to the cache until the vconnection is closed. no early reveals, the cache is committed-phobic until you close that vconnection πŸ’€

so when all the data has been transferred, the user (that's contp) must do a TSVConnClose. and if there are any errors?? the user must do an TSVConnAbort(contp, 0). like that's not optional, that's mandatory, periodt.

if the object CANNOT be written β€” the cache calls contp back with the event TS_EVENT_CACHE_OPEN_WRITE_FAILED. when does this happen? for example, if there's another object with the same key being written to the cache. drama, honestly. but good news: the user (contp) has the option to cancel the action that TSCacheWrite returned. so you're not stuck, you can dip 🌈

⚠️ also, heads up: reentrant calls are possible, meaning the cache can call back the user (contp) in the same call. it's giving "callback within a callback", it's giving main character energy, just be aware, fr fr 😭

2026, dev@trafficserver.apache.org


and that's the whole vibe check bestie, we ate and left no crumbs πŸ’–βœ¨ this was Apache Traffic Server 9.2, dated Feb 12, 2026, from your favorite TSCACHEWRITE(3ts) girlie, mwah, go write some cache objects responsibly πŸŽ€πŸ¦‹πŸ’…

πŸ“¦ where this page comes from