Skip to content
This repository has been archived by the owner on Jan 27, 2019. It is now read-only.

Async Contracts #8

Open
azjezz opened this issue Dec 21, 2018 · 0 comments
Open

Async Contracts #8

azjezz opened this issue Dec 21, 2018 · 0 comments

Comments

@azjezz
Copy link
Owner

azjezz commented Dec 21, 2018

i think it would be best to take advantage of Hack's async in some places here.

These contracts can be async, and probably should :

interface CacheItemPoolInterface extends ResetInterface
{
    public function getItem(string $key): Awaitable<CacheItemInterface>;

    public function getItems(Container<string> $keys = vec[]): Awaitable<KeyedContainer<string, CacheItemInterface>>;

    public function hasItem(string $key): Awaitable<bool>;

    public function clear(): Awaitable<bool>;

    public function deleteItem(string $key):  Awaitable<bool>;

    public function deleteItems(Container<string> $keys):  Awaitable<bool>;

    public function save(CacheItemInterface $item):  Awaitable<bool>;

    public function commit(): Awaitable<bool>;
}
interface CacheInterface
{
    public function get(string $key, mixed $default = null): Awaitable<mixed>;

    public function set(string $key, mixed $value, ?DateInterval $ttl = null): Awaitable<bool>;

    public function delete(string $key): Awaitable<bool>;

    public function clear(): Awaitable<bool>;

    public function getMultiple(Container<string> $keys,mixed $default = null): Awaitable<KeyedContainer<string, mixed>>;

    public function setMultiple(KeyedContainer<string, mixed> $values,?DateInterval $ttl = null): Awaitable<bool>;

    public function deleteMultiple(Container<string> $keys): Awaitable<bool>;

    public function has(string $key): Awaitable<bool>;
}
interface EventDispatcherInterface extends ResetInterface
{
    ...
    /**
     * Dispatch an event and call the listeners.
     */
    public function dispatch(EventInterface $event): Awaitable<EventInterface>;
    ...
}
interface RequestHandlerInterface
{
    /**
     * Handle the request and return a response.
     */
    public function handle(ServerRequestInterface $request): Awaitable<ResponseInterface>;
}
interface MiddlewareInterface
{
    /**
     * Process an incoming server request and return a response, optionally delegating
     * response creation to a handler.
     */
    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): Awaitable<ResponseInterface>;
}
@azjezz azjezz pinned this issue Dec 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant