I store each type of data in a sperate memory to make it easy to migrate, here is an example of how I am using it.
thread_local! {
static CONTRACTS_STORE: RefCell<StableBTreeMap<String, StoredContractVec, Memory>> = RefCell::new(
StableBTreeMap::init(
MEMORY_MANAGER.with(|m| m.borrow().get(MemoryId::new(6))),
)
);
static WALLETS_STORE: RefCell<StableBTreeMap<String, Wallet, Memory>> = RefCell::new(
StableBTreeMap::init(
MEMORY_MANAGER.with(|m| m.borrow().get(MemoryId::new(8))),
)
);
}
But I notice few people use only one static object.
struct AllMyData {
CONTRACTS_STORE:...
WALLETS_STORE: ...
}
static STORAGE: RefCell<StableBTreeMap<String, AllMyData, Memory>> = RefCell::new(
StableBTreeMap::init(
MEMORY_MANAGER.with(|m| m.borrow().get(MemoryId::new(0))),
)
);
What is the advantages of this practice ?