quota_clone
Default | [None] |
---|---|
Value | Named Filter |
See Also | |
Changes |
|
Named filter for initializing dictionary used to update with quota clone information.
redis_host = 127.0.0.1
redis_port = 6379
quota_clone {
dict redis {
}
}
quota-clone
) Quota clone plugin is useful when you want to store everybody's current quota usage to a database, but you don't want to use the database as the authoritative quota database.
For example you might want to access everybody's quota via Redis (or SQL) but you don't store the Redis database permanently so it could become empty once in a while.
Additionally, it is expensive to directly scan quota information from each individual user account, so quota-clone allows access to quota information that is less resource intensive.
In these example use-cases, you can use Quota Driver: Count as the authoritative quota database and make a copy of the quota usage to Redis. From Redis you could then once in a while gather everybody's current quota usage and send it to yet another place (e.g. for statistics handling).
Every time quota is updated, the value is updated to the cloned dict. There are race conditions with it so the quota may not always be 100% correct. The old value is always replaced with the new one though (not just incremented/decremented) so the cloned quota is never too much wrong.
quota_clone
Default | [None] |
---|---|
Value | Named Filter |
See Also | |
Changes |
|
Named filter for initializing dictionary used to update with quota clone information.
redis_host = 127.0.0.1
redis_port = 6379
quota_clone {
dict redis {
}
}
quota_clone_unset
Default | [None] |
---|---|
Value | boolean |
Changes |
|
Advanced Setting; this should not normally be changed. |
Unset quota information before updating. This is needed with some dict drivers that do not support upserting, such as SQL with older SQLite.
The keys that are written:
Key | Value |
---|---|
priv/quota/messages | Count of messages |
priv/quota/storage | Storage usage (in bytes) |
mail_plugins {
quota = yes
quota_clone = yes
}
redis_host = 127.0.0.1
redis_port = 6379
quota_clone {
dict redis {
}
}
More complex example using SQL:
dict_server {
dict mysql {
driver = sql
sql_driver = mysql
dict_map priv/quota/messages {
sql_table = quota
username_field = username
value_field messages {
}
}
dict_map priv/quota/storage {
sql_table = quota
username_field = username
value_field bytes {
}
}
}
}
quota_clone {
dict proxy {
name = mysql
}
}