From d5b820890b2ee55b14568738cec5a274fdf7233c Mon Sep 17 00:00:00 2001 From: Lonami Date: Thu, 12 Oct 2017 18:25:13 +0200 Subject: [PATCH] Mention library saves in memory full entities --- Session-Files.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Session-Files.md b/Session-Files.md index 1f9964a..6c4b62e 100644 --- a/Session-Files.md +++ b/Session-Files.md @@ -4,6 +4,8 @@ These JSON session files contain the required information to talk to the Telegra These files will by default also save all the input entities that you've seen, so that you can get information about an user or channel by just their ID. Telegram will **not** send their `access_hash` required to retrieve more information about them, if it thinks you have already seem them. For this reason, the library needs to store this information offline. +The library will by default too save all the entities (users with their name, username, chats and so on) **in memory**, not to disk, so that you can quickly access them by username or phone number. This can be disabled too. Run `help(client.session.entities)` to see the available methods (or `help(EntityDatabase)`). + If you're not going to work without updates, or don't need to cache the `access_hash` associated with the entities' ID, you can disable this by setting `client.session.save_entities = False`. If you don't want to save the files as JSON, you can also create your custom `Session` subclass and override the `.save()` and `.load()` methods. For example, you could save it on a database: