Skip to content

Cache improvements#3

Open
saulojg wants to merge 15 commits intoSebbia:masterfrom
saulojg:master
Open

Cache improvements#3
saulojg wants to merge 15 commits intoSebbia:masterfrom
saulojg:master

Conversation

@saulojg
Copy link
Copy Markdown

@saulojg saulojg commented May 4, 2017

Commit messages should be clear enough. Please reach me if you need further clarifications.

Both changes were properly tested, but outside the test suite since I can't get it to work right now. Here's the test case:

public void testNonCachedReads(){
    Category cached, otherCached, notCached;

    cached = new Category();
    cached.save();

    // read and retrieve from cache
    cached = new Select().from(Category.class).where("id = ?", cached.getId()).executeSingle();
    otherCached = new Select().from(Category.class).where("id = ?", cached.getId()).executeSingle();

    assertTrue(cached==otherCached);

    notCached = new Select().from(Category.class).where("id = ?", cached.getId())
            .setUseCache(false).executeSingle();

    assertTrue(cached!=notCached);
}

saulojg and others added 10 commits May 4, 2017 17:58
The read cache can be avoided when querying the database, by using the
new method com.activeandroid.query.From#setUseCache.
Additionally we've fixed the read cache implementation, which was used
only by the reflective (legacy) model filler. Now the read cache is
applied regardless of the particular model filler in use. We keep the
read cache enabled by default mainly for backwards compatibility
reasons.
saulojg added 5 commits March 19, 2026 13:13
- Upgrade Gradle wrapper from 1.8 to 8.7
- Update Java source/target compatibility from 1.6 to 1.8
- Replace deprecated 'compile' with 'implementation'
- Remove maven-publish plugin and gradle-mvn-push script
- Update android-maven-plugin groupId and version in pom-child.xml
Remove eager openDatabase() call from Cache.initialize() to prevent potential ANR on app startup. The database now opens lazily on the first actual query via Cache.openDatabase().
Remove eager openDatabase() call from Cache.initialize() to prevent potential ANR on app startup. The database now opens lazily on the first actual query via Cache.openDatabase().
Copies all @column field values (including the record ID) from a
source model onto this instance using reflection over TableInfo's
field collection.  Both instances must be of the same concrete type.

This supports cache-coherence patterns where a deserialized copy
needs to update an existing cached instance in-place without changing
its object identity.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant