-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implements #26 update dasgo fix missing GUILD_MEMBERS_CHUNK intents fix static check lint issues * edit concept information * fix enable intent functions * refactor shardmanager interface * implement SessionManager * update Gateway Rate Limit Handling * add Gateway tests for Session Manager, Rate Limits * remove TestGatewayGlobalRateLimit test * implement Shard Manager implement InstanceShardManager * add Shard integration test workflow * generate Send Event Shard Manager functions * update bundle * fix shard test workflow * fix data race in test * remove app ID write on ready event fix data race
- Loading branch information
1 parent
22302a7
commit 3da8b14
Showing
45 changed files
with
1,683 additions
and
403 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,32 @@ | ||
# What is a Cache? | ||
|
||
Disgo provides an **optional** cache along with a **cache interface** for your Discord Bot. Read [The Disgo Cache](/cache/README.md) for information about its implementation. | ||
A [cache (computing)](https://en.wikipedia.org/wiki/Cache_(computing)) is a component that stores data for quick retrieval. | ||
|
||
## Why Cache? | ||
|
||
## Why Do We Cache? | ||
A cache is an alternative to sending redundant requests — that take time to complete — to Discord: A cache stores data so that future requests for that data can be served immediately. | ||
|
||
Using **Requests** and **Sessions** allow you to retrieve data from Discord, but it becomes redundant to receive the same data over and over again. For example, retrieving _the amount of users in a guild_ requires a network request to be sent _to_ and returned _from_ Discord. Without a cache, retrieving _the exact same information_ requires yet another network request; even when guild's condition remains unchanged. A cache is an alternative to sending redundant requests — that take time to complete — to Discord: A cache stores data so that future requests for that data can be served immediately. | ||
For example, retrieving _the amount of users in a guild_ requires a network request to be sent to Discord, and another network request to be returned from Discord. Without a cache, retrieving _the exact same information_ again requires two more network requests, even when the guild's condition remains unchanged. | ||
|
||
## When to Use a Cache? | ||
|
||
Caches are useful for storing costly requests or calculations relevant to the lifetime of the application. In other words, a cache is **NOT** meant to be used for long-term storage. **If you need data to persist when your bot restarts, use a database.** | ||
Caches are useful for storing costly requests or calculations relevant to the application's lifetime. In other words, a cache is **NOT** meant to be used for long-term storage. | ||
|
||
**If you need data to persist when your bot restarts, use a database.** | ||
|
||
## How Does a Cache Work? | ||
|
||
Read [Caching Overview](https://aws.amazon.com/caching) for an in-depth explanation. A cache is typically stored in-memory which allows the application to store and retrieve data fast (with minimal latency). A cache that receives a request — for the amount of users in a guild — will store an entry for use later. When a request is made for _the exact same information_, the cache will use the in-memory entry instead of creating a costly network request. **Cache Invalidation** describes the process of replacing or removing cache entries. In the example above, we know to invalidate or update the stored value for the _amount of users in a guild_ when a user joins or leaves the server. For more information, read [Cache Invalidation](https://en.wikipedia.org/wiki/Cache_invalidation). | ||
_Read [Caching Overview](https://aws.amazon.com/caching) for an in-depth explanation._ | ||
|
||
A cache is typically stored in-memory, which allows the application to store and retrieve data fast (with minimal latency). | ||
|
||
A cache receiving a request — for the number of users in a guild — will store an entry for use later. When a request is made for _the exact same information_, the cache will use the in-memory entry instead of creating a costly network request. | ||
|
||
**Cache Invalidation** describes the process of replacing or removing cache entries. In the above example, we know to invalidate or update the stored value for the _amount of users in a guild_ when a user joins or leaves the server. | ||
|
||
_For more information, read [Cache Invalidation](https://en.wikipedia.org/wiki/Cache_invalidation)._ | ||
|
||
|
||
## How Do I Cache? | ||
|
||
Disgo provides an **optional** cache along with a **cache interface** for your Discord Bot. Read [The Disgo Cache](/cache/README.md) for information about its implementation. |
Oops, something went wrong.