aisk / Libae
Licence: bsd-3-clause
redis's async event loop library
Stars: ✭ 160
Programming Languages
c
50402 projects - #5 most used programming language
Projects that are alternatives of or similar to Libae
Laravel Event Broadcast
Laravel event broadcasting with Node.js, Redis & Socket.io
Stars: ✭ 5 (-96.87%)
Mutual labels: events, redis
Socketshark
A WebSocket message router based on Python/Redis/asyncio
Stars: ✭ 51 (-68.12%)
Mutual labels: asyncio, redis
Cpp Bredis
Boost::ASIO low-level redis client (connector)
Stars: ✭ 117 (-26.87%)
Mutual labels: redis, network
Arq
Fast job queuing and RPC in python with asyncio and redis.
Stars: ✭ 695 (+334.38%)
Mutual labels: asyncio, redis
Eventd
A simple daemon to track remote or local events and do actions the user wants to
Stars: ✭ 43 (-73.12%)
Mutual labels: events, network
Message Io
Event-driven message library for building network applications easy and fast.
Stars: ✭ 321 (+100.63%)
Mutual labels: events, network
Aiocache
Asyncio cache manager for redis, memcached and memory
Stars: ✭ 496 (+210%)
Mutual labels: asyncio, redis
Gofamily
🔥 大厂 BAT 面试高频知识点,后端技术体系。包含了 C GO Python, 网络,Redis ,MySQL ,消息队列 ,高并发,微服务,缓存,操作系统,算法,LeetCode 刷题等知识
Stars: ✭ 474 (+196.25%)
Mutual labels: redis, network
Java Knowledge Mind Map
【🌱🌱Java服务端知识技能图谱】用思维脑图梳理汇总Java服务端知识技能
Stars: ✭ 787 (+391.88%)
Mutual labels: redis, network
Ring
Python cache interface with clean API and built-in memcache & redis + asyncio support.
Stars: ✭ 404 (+152.5%)
Mutual labels: asyncio, redis
Metta
An information security preparedness tool to do adversarial simulation.
Stars: ✭ 867 (+441.88%)
Mutual labels: redis, network
Aioredlock
🔒 The asyncio implemetation of Redis distributed locks
Stars: ✭ 171 (+6.88%)
Mutual labels: asyncio, redis
tomodachi
💻 Microservice library / framework using Python's asyncio event loop with full support for HTTP + WebSockets, AWS SNS+SQS, RabbitMQ / AMQP, middleware, etc. Extendable for GraphQL, protobuf, gRPC, among other technologies.
Stars: ✭ 170 (+6.25%)
Mutual labels: events, asyncio
Vibe Core
Repository for the next generation of vibe.d's core package.
Stars: ✭ 56 (-65%)
Mutual labels: asyncio, network
Cash
HTTP response caching for Koa. Supports Redis, in-memory store, and more!
Stars: ✭ 122 (-23.75%)
Mutual labels: redis, network
libae
Redis's async event library, you can use it in your projects.
supported event multiplexing model
epoll
kqueue
ev_port
select
Example
Timer
Print Hello, World
on screen every 10 seconds:
int print(struct aeEventLoop *loop, long long id, void *clientData)
{
printf("%lld - Hello, World\n", id);
return -1;
}
int main(void)
{
aeEventLoop *loop = aeCreateEventLoop(0);
int i;
for (i = 0; i < 10; i ++) {
aeCreateTimeEvent(loop, i*1000, print, NULL, NULL);
}
aeMain(loop);
aeDeleteEventLoop(loop);
return 0;
}
Echo server
Start an echo server on 8000:
void writeToClient(aeEventLoop *loop, int fd, void *clientdata, int mask)
{
char *buffer = clientdata;
printf("%p\n", clientdata);
write(fd, buffer, strlen(buffer));
free(buffer);
aeDeleteFileEvent(loop, fd, AE_WRITABLE);
}
void readFromClient(aeEventLoop *loop, int fd, void *clientdata, int mask)
{
int buffer_size = 1024;
char *buffer = malloc(sizeof(char) * buffer_size);
bzero(buffer, buffer_size);
int size;
size = read(fd, buffer, buffer_size);
aeCreateFileEvent(loop, fd, AE_WRITABLE, writeToClient, buffer);
}
void acceptTcpHandler(aeEventLoop *loop, int fd, void *clientdata, int mask)
{
int client_port, client_fd;
char client_ip[128];
// create client socket
client_fd = anetTcpAccept(NULL, fd, client_ip, 128, &client_port);
printf("Accepted %s:%d\n", client_ip, client_port);
// set client socket non-block
anetNonBlock(NULL, client_fd);
// regist on message callback
int ret;
ret = aeCreateFileEvent(loop, client_fd, AE_READABLE, readFromClient, NULL);
assert(ret != AE_ERR);
}
int main()
{
int ipfd;
// create server socket
ipfd = anetTcpServer(NULL, 8000, "0.0.0.0", 0);
assert(ipfd != ANET_ERR);
// create main event loop
aeEventLoop *loop;
loop = aeCreateEventLoop(1024);
// regist socket connect callback
int ret;
ret = aeCreateFileEvent(loop, ipfd, AE_READABLE, acceptTcpHandler, NULL);
assert(ret != AE_ERR);
// start main loop
aeMain(loop);
// stop loop
aeDeleteEventLoop(loop);
return 0;
}
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].