How would go about finding out whether a record is locked or not (keep in mind I have not gotten to the locking part yet, nor have I payed a whole lot of attention on the lock and unlock methods in my DB interface, so bear with me.)
I also chose caching in my project. I used null for deleted records in the ArrayList. However, in the create method, instead of going ArrayList.indexOf(null), which is the easy way, I would suggest looking for a deleted record which is unlocked (the first way one could find a locked deleted record.) This is something you will come against as you program further...
You may assume that at nay moment, at most one program is accessing the database file; therefore your locking system only needs to be concerned with multiple concurrent clients of your server.
But my questioning to update is this: what would happen in this situation: two programs run on separate jvm and both use the same data file, eg. client a is standalone, client b is a networked connect to localhost on the same machine with server using the data file as the client a is using. if using cache, client a won't be noted the database change when client b changed it. and verse vice. This is problem I am having now when I am testing my code