Skip to main content

A simple counter module.

Project description

System Requirements

  • Python >= 3.7
  • moca_core
  • aioredis

Installation

pip install moca_counter==1.0.2
or
pip install moca_counter

Overview

English

This is a simple counter module for MocaSystem. Developed by el.ideal-ideas for Moca System.


日本語

これはel.ideal-ideasによって開発されたモカシステムのためのシンプルなカウンターモジュールです。


简体中文

这是el.ideal-ideas为茉客系统开发的计数器模块。

Usage Example

# MocaCounter and MocaAsyncCounter have same methods.
# MocaCounterとMocaAsyncCounterは同じメソッドを所有しています。
# MocaCounter和MocaAsyncCounter拥有相同的方法。

# Create driver
# ドライバー作成
# 生成驱动
driver = InMemoryDriver()

# Instantiate the Counter.
# カウンターのインスタント化。
# 创建计数器的实例。
counter = MocaCounter(driver)

# count up or down.
# カウントする。
# 计数。
counter.add('test', 2)
counter.add('test', -3)
Main Methods
  • def add(key: str, value: int = 1) -> Tuple[bool, Optional[int], str]:

    • Add count.
    • カウントアップ。
    • 数值增加。
  • def set(key: str, value: int) -> Tuple[bool, str]:

    • Set count.
    • カウントを設定。
    • 设定计数器的值。
  • def get(key: str, default: Optional[int] = None) -> Tuple[Optional[int], str]:

    • Get count.
    • カウントを取得。
    • 获取计数器的值。
  • def clear(key: str) -> Tuple[bool, str]:

    • Clear count.
    • カウントをクリアします。
    • 清空计数器。

License

  • MIT License
Copyright 2020.1.17 <el.ideal-ideas: https://www.el-ideal-ideas.com>

Permission is hereby granted, free of charge, 
to any person obtaining a copy of this software 
and associated documentation files (the "Software"),
to deal in the Software without restriction, 
including without limitation the rights to use, copy, 
modify, merge, publish, distribute, sublicense, 
and/or sell copies of the Software, and to permit persons
to whom the Software is furnished to do so, 
subject to the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH 
THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Other Information

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for moca-counter, version 1.0.2
Filename, size File type Python version Upload date Hashes
Filename, size moca_counter-1.0.2-py3-none-any.whl (15.1 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size moca_counter-1.0.2.tar.gz (9.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page