Java Code Examples for com.orhanobut.hawk.Hawk#clear()

The following examples show how to use com.orhanobut.hawk.Hawk#clear() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Benchmark.java    From Iron with Apache License 2.0 6 votes vote down vote up
@Test
public void testReadWrite500Contacts() throws Exception {
    final List<Person> contacts = TestDataGenerator.genPersonList(500);
    Iron.init(getTargetContext());
    //Iron.setCache(Cache.MEMORY);
    Iron.chest("keys").destroy();
    Iron.chest().destroy();
    //Iron.setEncryptionExtension(new IronEncryption());
    long ironTime = runTest(new IronReadWriteContactsTest(), contacts, REPEAT_COUNT);

    assertFalse(Iron.chest().<List<Person>>read("contacts1").isEmpty());

    Hawk.init(getTargetContext());
    Hawk.clear();
    long hawkTime = runTest(new HawkReadWriteContactsTest(), contacts, REPEAT_COUNT);

    final List<PersonArg> contactsArg = TestDataGenerator.genPersonArgList(500);
    Iron.init(getTargetContext());
    Iron.chest().destroy();
    long ironArg = runTest(new IronReadWriteContactsArgTest(), contactsArg, REPEAT_COUNT);

    printResults("Read/write 500 contacts", ironTime, hawkTime, ironArg);
}
 
Example 2
Source File: Benchmark.java    From Iron with Apache License 2.0 6 votes vote down vote up
@Test
public void testWrite500Contacts() throws Exception {
    final List<Person> contacts = TestDataGenerator.genPersonList(500);
    Iron.init(getTargetContext());
    //Iron.setCache(Cache.MEMORY);
    Iron.chest("keys").destroy();
    Iron.chest().destroy();
    //Iron.setEncryptionExtension(new IronEncryption());
    long ironTime = runTest(new IronWriteContactsTest(), contacts, REPEAT_COUNT);

    assertFalse(Iron.chest().<List<Person>>read("contacts1").isEmpty());

    Hawk.init(getTargetContext());
    Hawk.clear();
    long hawkTime = runTest(new HawkWriteContactsTest(), contacts, REPEAT_COUNT);

    printResults("Write 500 contacts", ironTime, hawkTime);
}
 
Example 3
Source File: Benchmark.java    From Iron with Apache License 2.0 6 votes vote down vote up
@Test
public void testRead500Contacts() throws Exception {
    final List<Person> contacts = TestDataGenerator.genPersonList(500);
    Iron.init(getTargetContext());
    //Iron.setCache(Cache.MEMORY);
    Iron.chest("keys").destroy();
    Iron.chest().destroy();
    //Iron.setEncryptionExtension(new IronEncryption());
    runTest(new IronWriteContactsTest(), contacts, REPEAT_COUNT); //Prepare
    long ironTime = runTest(new IronReadContactsTest(), contacts, REPEAT_COUNT);

    assertFalse(Iron.chest().<List<Person>>read("contacts1").isEmpty());

    Hawk.init(getTargetContext());
    Hawk.clear();
    runTest(new HawkWriteContactsTest(), contacts, REPEAT_COUNT); //Prepare
    long hawkTime = runTest(new HawkReadContactsTest(), contacts, REPEAT_COUNT);

    printResults("Read 500 contacts", ironTime, hawkTime);
}
 
Example 4
Source File: Benchmark.java    From Paper with Apache License 2.0 5 votes vote down vote up
@Test
public void testReadWrite500Contacts() throws Exception {
    final List<Person> contacts = TestDataGenerator.genPersonList(500);
    Paper.init(getTargetContext());
    Paper.book().destroy();
    long paperTime = runTest(new PaperReadWriteContactsTest(), contacts, REPEAT_COUNT);

    Hawk.init(getTargetContext());
    Hawk.clear();
    long hawkTime = runTest(new HawkReadWriteContactsTest(), contacts, REPEAT_COUNT);

    final List<PersonArg> contactsArg = TestDataGenerator.genPersonArgList(500);
    Paper.init(getTargetContext());
    Paper.book().destroy();
    long paperArg = runTest(new PaperReadWriteContactsArgTest(), contactsArg, REPEAT_COUNT);

    printResults("Read/write 500 contacts", paperTime, hawkTime, paperArg);
}
 
Example 5
Source File: Benchmark.java    From Paper with Apache License 2.0 5 votes vote down vote up
@Test
public void testWrite500Contacts() throws Exception {
    final List<Person> contacts = TestDataGenerator.genPersonList(500);
    Paper.init(getTargetContext());
    Paper.book().destroy();
    long paperTime = runTest(new PaperWriteContactsTest(), contacts, REPEAT_COUNT);

    Hawk.init(getTargetContext());
    Hawk.clear();
    long hawkTime = runTest(new HawkWriteContactsTest(), contacts, REPEAT_COUNT);

    printResults("Write 500 contacts", paperTime, hawkTime);
}
 
Example 6
Source File: Benchmark.java    From Paper with Apache License 2.0 5 votes vote down vote up
@Test
public void testRead500Contacts() throws Exception {
    final List<Person> contacts = TestDataGenerator.genPersonList(500);
    Paper.init(getTargetContext());
    Paper.book().destroy();
    runTest(new PaperWriteContactsTest(), contacts, REPEAT_COUNT); //Prepare
    long paperTime = runTest(new PaperReadContactsTest(), contacts, REPEAT_COUNT);

    Hawk.init(getTargetContext());
    Hawk.clear();
    runTest(new HawkWriteContactsTest(), contacts, REPEAT_COUNT); //Prepare
    long hawkTime = runTest(new HawkReadContactsTest(), contacts, REPEAT_COUNT);

    printResults("Read 500 contacts", paperTime, hawkTime);
}
 
Example 7
Source File: HawkKeyValueStorage.java    From AndroidSchool with Apache License 2.0 4 votes vote down vote up
@Override
public void clear() {
    Hawk.clear();
}
 
Example 8
Source File: HawkKeyValueStorage.java    From AndroidSchool with Apache License 2.0 4 votes vote down vote up
@Override
public void clear() {
    Hawk.clear();
}