Haploo Local Cache Files

Prev Next

Understanding Haploo Caching Mac/iOS/Windows


1. Using Local Side Caching

Haploo uses dedicated sqlite cache database to conduct background syncing operation for your FM App files. When your FM File creates, edits, or deletes a record in one of your syncing tables (you decided which tables post data) a record or operation is created inside this nearby cache database that Haploo Plugin builds, and maintains for your solution. Each record change loads to a queue of pending operations. These pending operations post to the Haploo Sync Servers in the order in which they are received. Once these items reach the server, they are cleared from the local cache file as they are now safely reside on Haploo Cloud. If using a Offline solution on iOS, the cache will be built in the documents directory, you may use itunes or mac finder to pull the cache files from an iOS Device. If using an online or FMS hosted file, the cache will be created on the Mac's Documents Directory. This cache is used for storing and posting changes to Haploo Cloud. If using an Offline, solution on a Mac, the cache will be stored in the same directory as the FMP File that it is associated with. Windows has a few options of choosing where to place the local side cache. For FMS, haploo will use the FMS's Documents directory.

2. Understanding Cache's Last Sync Timestamp

Additionally, when Haploo Sync "Pulls" transactions down then processes them into the FM Solution that they belong to, it will update a configuration table inside the cache with a UTC Timestamp of the last sync time. This last sync time stamp applies to all tables and all fields. The time stamp represents where the "buddy" FM file's data is caught up to. When all sync operations complete and there are no outstanding SQL Transactions to pull and then process, each FM File no matter where it resides will be exact copies of each other. There is no true "Master" copy as all completely synced copies of the FM Solution would be considered masters.

3. Opening, Exploring, & Closing Cached DBs

You may also wish to troubleshoot issues by exploring the contents of these SQLITE cache databases. We use https://sqlitebrowser.org/dl/ for this task. We will also open the cache, then close the sqlite database to prep the it for zipping and deployment on our dropbox CI folder. We do this in order to reseed the FM Solution File(s). If we do not include the "buddy" sqlite file in the upgrade or install package, each user would pull every sync transaction since the beginning of time and if there are 100,000s or millions the sync time would be significant and unncessary, as the FM File being deployed as already "seen" and "processed" these transactions overtime or by the FM Developer.

Windows Machines

For Windows clients, we do not use a SQLITE cache DB, we use a directory storage scheme to allow for significantly faster posting of data. The Mac and iOS will eventually move to the storage scheme for local offline caching. Window's uses a text file with a Time Stamp string which would be consider the time the FM File was caught up to. You may wish to apply the same logic with this text file as the logic applied to the MacOS / iOS sqlite.db file for advancing the timestamp and preventing redunant and uncessary sync time.

4. Deleting Caches to Clear Last Sync Times or Errors

More on the Cache Files and the Windows LastSync.txt file. If you were to delete these files and relaunch the solution, the solution would automatically regenerate these files and process all sync records. This might be a useful excercise in a development enviroment to look for syntax errors in FM Execute SQL statements. Most of the time, you will want to do this excercise extensively when onboarding haploo sync technologies into your solution. We will cover more on how to debug these statements within another article.

5. Backing Up Caches and Offline FM Files

If you do happen across an end user who cannot post or is experiencing difficultly, grabbing the sqlite or Windows Cache Directory, would be very useful and aid you in recovering any data that may have not posted to Haploo Cloud Servers. Also remember to grab the end user's local copy of their FM Solution File as any missing data will still reside inside the FMP Database and / or the SQLITE / Cache Location.