semvec/pypi-packages huggingface dataset:
method-cache 1.0.4
Simple TTL Cache for methods and there results.

# Python Method Cache

[![Build Status](https://travis-ci.org/eieste/MethodCache.svg?branch=master)](https://travis-ci.org/eieste/MethodCache)
[![PyPI version](https://badge.fury.io/py/method-cache.svg)](https://badge.fury.io/py/method-cache)
[![Documentation Status](https://readthedocs.org/projects/methodcache/badge/?version=latest)](https://methodcache.readthedocs.io/en/latest/?badge=latest)

## What it does

MethodCache can be used to cache the result of an method in a flexible way.
This libary has no dependencies!

**Currently only TTL Cache available**

The cache storage can be segmented in categories.
Methods with the ``@cache`` decorator are saved in these categories.

## Example
```python
from methodcache import cache, Store
import time

# TTL in Seconds (Default TTl is 60)
st = Store(ttl=60*300)

# Define Store for this Cache, and overwrite Store TTL. And categorize this cache object to demo
@cache(store=st, ttl=5, category="demo")
def doothings(a,b,c):
    # Do here what ever you want.
    # eg. MySQL querys or other slow operations
    time.sleep(2)
    return a+b+c

# Slow Execution
doothings(1,2,3)
# Slow Execution

doothings(4,5,6)

# Fast Execution because the Cache was used
doothings(1,2,3)
time.sleep(2)

# Slow Execution because the Cache TTL is Expired
doothings(1,2,3)

```

## Documentation

[Read the Docs](https://methodcache.readthedocs.io/en/latest/)

or 
show ``example.py``
pony-rest 3.1
Restful API generated by ponyorm and falcon
Keywords: rest,restful,pony,http,api

# pony-rest

A subset implementation of `PostgREST`.

You should read [PostgREST](http://postgrest.org/) and [PonyORM](https://docs.ponyorm.com/) first.

### Install

```
pip install pony-rest
```

### Example

Edit `entities.py`:

```python
from pony.orm import *

db = Database()

class Person(db.Entity):
    name = Required(str)
    age = Required(int)
    cars = Set('Car')

class Car(db.Entity):
    make = Required(str)
    model = Required(str)
    owner = Required(Person)
```

then:
```
python -m pony_rest
```

or via wsgi:
```
gunicorn pony_rest
```

### How to use this server to do CRUD

```sh
T=localhost:3333

# create new Person
curl -H 'content-type: application/json' -d '{"name": "foo", "age": 10}' $T/person

# read Person list
curl localhost:18000/person

# update Person where id is 1
curl -H 'content-type: application/json' -X PATCH -d '{"age": 10}' "$T/person?id=eq.1"

# delete Person where id is 1
curl -X DELETE "$T/person?id=eq.1"
```

### Connect your database

Install module [pyyaml](https://pyyaml.org/), then create a configure file: `database.yaml` in your working directory, likes:
```
provider: sqlite
filename: ":memory:"
create_db: true
create_tables: true
```

...and see [database.yaml](database.yaml) in this repo to find more.

Note: only the first block configurations in yaml file is used for database,
you could leave the old configurations in next blocks.

### Lots TODO...