I would do this by creating a subclass of DYNAMICPROPS that uses an array of cells to store data inside. Thus, you can dynamically add additional data to the object.
Here is the basic design idea:
Data is stored in an array of cells. Each property gets its own row, with the first column being the name of the property (for convenience), the second column is the function descriptor for calculating the data, the third column is the data, the fourth column is the time it takes to generate the data, and the fifth column is an array, say, of length 100, which stores timestamps corresponding to when the resource was accessed the last 100 times, and the sixth column contains a variable size.
There is a general get method that takes as input the string corresponding to the property (see below). The get method first checks to see if column 3 is empty. If not, it returns a value and saves a timestamp. If so, it does the calculation using the descriptor from column 1 inside the TIC / TOC expression to measure how expensive the calculation is (which is stored in col4 and the timestamp is stored in col5). He then checks to see if there is enough space to store the result. If so, then it stores the data, otherwise it checks the size, as well as the product, of how many times the data was available, how long it will take to recover to decide what to select.
In addition, there is a 'add' property that adds a string to an array of cells, creates a dynamic property (using addprops ) with the same name as the function handle, and sets the get-method to myGetMethod(myPropertyIndex) . If you need to pass parameters to a function, you can create an additional property, myDynamicPropertyName_parameters , using the set method, which will delete previously calculated data whenever the parameter values โโchange.
Finally, you can add several dependent properties that can determine how many properties exist (the number of rows in the array of cells), how they are called (the first column of the array of cells), etc.