summaryrefslogtreecommitdiff
path: root/src/components/redis/rd_lock.h
blob: 171bb004bc2168b5b3d53d6f3b0e5c20e78997bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*************************************************************************
	> File Name: rd_lock.h
	> Author:
	> Mail:
	> Created Time: 2018年07月05日 星期四 11时02分03秒
 ************************************************************************/

#ifndef _RD_LOCK_H
#define _RD_LOCK_H

#include "hiredis.h"

struct rd_lock_scb{
    int  m_validityTime;
    sds  m_resource;
    sds  m_val;
};

void rd_lock_init();

void rd_lock_fini();

int rd_mutex_lock(const char *resource, const int ttl,
                 struct rd_lock_scb *mtx, struct redisContext *c);

int rd_mutex_unlock(struct rd_lock_scb *mtx, struct redisContext *c);

#endif