Skip to content

use local cache instead of syncing #2

@zeruth

Description

@zeruth

I suggest using the cache module of runelite itself.

Something along the lines of:

	public void dumpCache() throws IOException
	{
		Store store = new Store(DEFAULT_CACHE_DIR);
		store.load();
		Storage storage = store.getStorage();
		store.getIndexes().forEach(index ->
		{
			log.debug("Dumping index " + (index.getId() + 1) + "/20");
			index.getArchives().forEach(archive ->
			{
				try
				{
					byte[] archiveData = storage.loadArchive(archive);
					if (index.getId() == 5)
					CacheFiles.write(index.getId(), archive.getArchiveId(), archiveData);
					else
					{
						archive.getFiles(archiveData).getFiles().forEach(fsFile ->
							CacheFiles.write(index.getId(), archive.getArchiveId(), fsFile.getContents()));
					}
				}
				catch (IOException e)
				{
					e.printStackTrace();
				}
			});
		});
	}

And maybe detect an incomplete cache or wait until LOGIN_SCREEN as you have a full cache by that time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions