odnoklassniki / one-nio

Unconventional I/O library for Java
Apache License 2.0
655 stars 97 forks source link

Tutorial/Docs in-memory off-heap #7

Open Pro100AlexHell opened 8 years ago

Pro100AlexHell commented 8 years ago

Please make a tutorial and docs: how to create in-memory (off-heap) objects, how to allocate, how to serialize/deserialize (if need, i can't understand) this to byte array (located off-heap), how to change it fields. For example now (in current system) I have class User { long Id; List[ItemA] ItemsA; // class ItemA { .. } List[ItemB] ItemsB; // class ItemB { .. } // and many more field }

// and global collection static HashMap[long, User] AllUsers;

// .. dynamically created users, dynamically filled ItemsA, B, ..

as I understand, I need use SharedMemoryMap.java or subclasses, but can't understend how. and how to allocate new User, it's new ItemA, how to put, get to User.ItemsA collection.

is it enough to replace my static HashMap[long, User] AllUsers into SharedMemoryMap[long, User] or not?


should I see https://github.com/odnoklassniki/shared-memory-cache ? can't understand where is the full cache/allocate code.