The preferencesutils tool class can be a simple object (it can cache all the simple attributes of public in the object)
In addition, the differences between preference storage and direct use of object file caching methods are studied. 1. Efficiency in file writing for the first time. Direct cache of object files is faster than preference. 2. Size, the direct cache object file is smaller than the preference file. 3. The cache directory is different. The preference file is cached in shared_prefs. Based on our settings, you can select the directory where two operations are performed to clear the cache: files under the Data/application/caches directory will be deleted to clear the data: All files except the lib directory will be deleted, including shared_prefs, if the selected directory for caching object files is not under caches and files or other directories are used, the only disadvantage of preference and preference also disappears. In essence, they are all read/write operations, but preference uses XML storage, which means there are redundant nodes and redundant conversions. In the second write, sharedpreferencesimpl uses other mechanisms, so it performs very fast. Next we will discuss the storage principle of sharedpreference to see if its cache mechanism is suitable for objects with frequently changed content. Source code: https://github.com/AltasT/PreferenceVObjectFilehttps://github.com/AltasT/PreferenceVObjectFile/archive/master.zip
Use sharedpreference and object stream to store objects