Cached works with L2Server in the shared memory about shared memory read THIS, as it name says, its a cache for better understanding read THIS it will give you some idea about it. So mostly the CacheD stores the data for future use for the L2Server, and acts like a bridge between L2Server and SQL Server, executing all the queries and stored procedures. So when you send a packet directly to the CacheD is made available in-game, opposed to when you write it directly inside the database which doesn't make it available in-game cause the CacheD didn't loaded it in memory.
Also there is an old C4 dupe if i remember that occurs here due to a duplicated stack of items, one from CacheD and other from L2Server but that is a different story.
About formats of the packets, you can find them in the CacheD functions, i will check in my cloud and see if i can find a library that will work for you.
P.S: Mac correct me if im wrong, confused or missed something :P