HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Questions on cache storage and array size.

02-28-2004, 04:52 PM#1
Alfryd
I've looked up a thread or two on how to use the game cache to store private data for individual objects persistently, but for the life of me I can't find the original thread displaying the actual code in depth. What I need to know is- are there functions that can delete data from the cache after it's been used?

Also, what's the fixed size for arrays declared in JASS? How many bytes would each index occupy for various variables types?

Thanks for your time.
02-28-2004, 05:34 PM#2
weaaddar
8192 is array size.
Its 4 bytes for each type. I'm not sure the size of the index.
Code:
native  ReloadGameCachesFromDisk takes nothing returns boolean

native  InitGameCache   takes string campaignFile returns gamecache
native  SaveGameCache   takes gamecache whichCache returns boolean

native  StoreInteger    takes gamecache cache, string missionKey, string key, integer value returns nothing
native  StoreReal       takes gamecache cache, string missionKey, string key, real value returns nothing
native  StoreBoolean    takes gamecache cache, string missionKey, string key, boolean value returns nothing
native  StoreUnit       takes gamecache cache, string missionKey, string key, unit whichUnit returns boolean
native  StoreString     takes gamecache cache, string missionKey, string key, string value returns boolean

native SyncStoredInteger        takes gamecache cache, string missionKey, string key returns nothing
native SyncStoredReal           takes gamecache cache, string missionKey, string key returns nothing
native SyncStoredBoolean        takes gamecache cache, string missionKey, string key returns nothing
native SyncStoredUnit           takes gamecache cache, string missionKey, string key returns nothing
native SyncStoredString         takes gamecache cache, string missionKey, string key returns nothing

// Will return 0 if the specified value's data is not found in the cache
native  GetStoredInteger        takes gamecache cache, string missionKey, string key returns integer
native  GetStoredReal           takes gamecache cache, string missionKey, string key returns real
native  GetStoredBoolean        takes gamecache cache, string missionKey, string key returns boolean
native  GetStoredString         takes gamecache cache, string missionKey, string key returns string
native  RestoreUnit             takes gamecache cache, string missionKey, string key, player forWhichPlayer, real x, real y, real facing returns unit

native  HaveStoredInteger        takes gamecache cache, string missionKey, string key returns boolean
native  HaveStoredReal           takes gamecache cache, string missionKey, string key returns boolean
native  HaveStoredBoolean        takes gamecache cache, string missionKey, string key returns boolean
native  HaveStoredUnit           takes gamecache cache, string missionKey, string key returns boolean
native  HaveStoredString         takes gamecache cache, string missionKey, string key returns boolean

native  FlushGameCache          takes gamecache cache returns nothing
native  FlushStoredMission      takes gamecache cache, string missionKey returns nothing
native  FlushStoredInteger      takes gamecache cache, string missionKey, string key returns nothing
native  FlushStoredReal         takes gamecache cache, string missionKey, string key returns nothing
native  FlushStoredBoolean      takes gamecache cache, string missionKey, string key returns nothing
native  FlushStoredUnit         takes gamecache cache, string missionKey, string key returns nothing
native  FlushStoredString       takes gamecache cache, string missionKey, string key returns nothing
There is the full GameCache api as you can see the flush commands can be used to empty those entries. But if you are storing handle (using return bug) remember to destroy them first.