Warning - made on the course project and has serious flaws. Memory release must be called through a special method and the garbage collector starts collecting information in the same thread and does so very slowly. Objects are written to files in groups and there are no logs, so the reliability of an OOSUBD is lower than that of any commercial one. And yet there are pluses)))
var DB = new QueryManager(1, @"Output\md.zip", true, 0.4, @"Output\index.zip", 50, @"Output\imd.zip", 0.0, true); var firstObjectID = DB.AddObject(new MyClass{ Name = "Hello", Data = "World!" }); var secondObjectID = DB.AddObject(new MyClass{ Name = "Hi", Data = "People!" }); var firstSelectedObject = DB.Select(firstObjectID).Data as MyClass; var secondSelectedObject = DB.Select(secondObjectID).Data as MyClass; Console.WriteLine("First object ID: {0}\nSecond object ID: {1}\n", firstObjectID, secondObjectID); Console.WriteLine("First selected object: {0}", firstSelectedObject.Name + ", " + firstSelectedObject.Data); Console.WriteLine("Second selected object: {0}", secondSelectedObject.Name + ", " + secondSelectedObject.Data); DB.Dispose(); var DB2 = new QueryManager(1, @"Output\md.zip", false, 0.4, @"Output\index.zip", 50, @"Output\imd.zip", 0.0, true); var firstSelectedObject2 = DB2.Select(firstObjectID).Data as MyClass; var secondSelectedObject2 = DB2.Select(secondObjectID).Data as MyClass;
')
Talking class diagram (not complete - just what you need to use):
I was inspired by the simplicity of memcached so there is such a small number of requests. Requests are triggered only if there is enough RAM.
Honestly, I use this craft to read / save data structures to disk. Very convenient due to the fact that OOSUBD itself uses the cool Newtonsoft.Json serializer and standard archiving tools for .NET. This allows you to put on the disk any data structure without the need to pre-create a data scheme, while this will be done in portions of N objects, and N can be set.
I anticipate the question “why produce bikes?” - working with large files is often faster and if the developer realizes how this can be done more efficiently in his application, the recording performance can be significantly increased (at the price of reliability naturally).