EgtExecutor 2.7j4 :
- in Redis aggiunta gestione di connessioni multiple.
This commit is contained in:
+692
-535
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+51
-31
@@ -28,20 +28,24 @@ LuaRedisConnect( lua_State* L)
|
||||
LuaCheckParam( L, 1, sConnection)
|
||||
LuaClearStack( L) ;
|
||||
// Imposto la connessione
|
||||
bool bOk = ExeRedisConnect( sConnection) ;
|
||||
int nIdConnection = 0 ;
|
||||
bool bOk = ExeRedisConnect( sConnection, nIdConnection) ;
|
||||
// Restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
LuaSetParam( L, nIdConnection) ;
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaRedisDisconnect( lua_State* L)
|
||||
{
|
||||
// Nessun paramtro
|
||||
// 1 parametro : nIdConnection
|
||||
int nIdConnection = 0 ;
|
||||
LuaCheckParam( L, 1, nIdConnection) ;
|
||||
LuaClearStack( L) ;
|
||||
// Imposto la connessione
|
||||
bool bOk = ExeRedisDisconnect() ;
|
||||
bool bOk = ExeRedisDisconnect( nIdConnection) ;
|
||||
// Restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
@@ -51,14 +55,16 @@ LuaRedisDisconnect( lua_State* L)
|
||||
static int
|
||||
LuaRedisSetValFromKey( lua_State* L)
|
||||
{
|
||||
// 2 parametri : sKey, sVal
|
||||
// 3 parametri : nIdConnection, sKey, sVal
|
||||
int nIdConnection = 0 ;
|
||||
LuaCheckParam( L, 1, nIdConnection) ;
|
||||
string sKey ;
|
||||
LuaCheckParam( L, 1, sKey) ;
|
||||
LuaCheckParam( L, 2, sKey) ;
|
||||
string sVal ;
|
||||
LuaCheckParam( L, 2, sVal) ;
|
||||
LuaCheckParam( L, 3, sVal) ;
|
||||
LuaClearStack( L) ;
|
||||
// Imposto il valore della chiave
|
||||
bool bOk = ExeRedisSetValFromKey( sKey, sVal) ;
|
||||
bool bOk = ExeRedisSetValFromKey( nIdConnection, sKey, sVal) ;
|
||||
// Restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
@@ -68,13 +74,15 @@ LuaRedisSetValFromKey( lua_State* L)
|
||||
static int
|
||||
LuaRedisGetValFromKey( lua_State* L)
|
||||
{
|
||||
// 1 parametro : sKey
|
||||
// 2 parametri : nIdConnection, sKey
|
||||
int nIdConnection = 0 ;
|
||||
LuaCheckParam( L, 1, nIdConnection) ;
|
||||
string sKey ;
|
||||
LuaCheckParam( L, 1, sKey)
|
||||
LuaCheckParam( L, 2, sKey)
|
||||
LuaClearStack( L) ;
|
||||
// Recupero il valore della chiave
|
||||
string sVal, sType ;
|
||||
bool bOk = ExeRedisGetValFromKey( sKey, sVal) ;
|
||||
bool bOk = ExeRedisGetValFromKey( nIdConnection, sKey, sVal) ;
|
||||
// Restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
LuaSetParam( L, sVal) ;
|
||||
@@ -85,25 +93,29 @@ LuaRedisGetValFromKey( lua_State* L)
|
||||
static int
|
||||
LuaRedisAsyncConnect( lua_State* L)
|
||||
{
|
||||
// 1 parametro : sConnection
|
||||
// 2 parametri : sConnection
|
||||
string sConnection ;
|
||||
LuaCheckParam( L, 1, sConnection)
|
||||
LuaClearStack( L) ;
|
||||
// Imposto la connessione
|
||||
bool bOk = ExeRedisAsyncConnect( sConnection) ;
|
||||
int nIdConnection = -1 ;
|
||||
bool bOk = ExeRedisAsyncConnect( sConnection, nIdConnection) ;
|
||||
// Restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
LuaSetParam( L, nIdConnection) ;
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaRedisAsyncDiconnect( lua_State* L)
|
||||
{
|
||||
// Nessun parametro
|
||||
// 1 parametro : nIdConnection
|
||||
int nIdConnection = 0 ;
|
||||
LuaCheckParam( L, 1, nIdConnection) ;
|
||||
LuaClearStack( L) ;
|
||||
// Imposto la connessione
|
||||
bool bOK = ExeRedisAsyncDisconnect() ;
|
||||
bool bOK = ExeRedisAsyncDisconnect( nIdConnection) ;
|
||||
// Restituisco il risultato
|
||||
LuaSetParam( L, bOK) ;
|
||||
return 1 ;
|
||||
@@ -113,14 +125,16 @@ LuaRedisAsyncDiconnect( lua_State* L)
|
||||
static int
|
||||
LuaRedisAsyncPublish( lua_State* L)
|
||||
{
|
||||
// 2 parametri : sChannel, sMessage
|
||||
// 3 parametri : nIdConnection, sChannel, sMessage
|
||||
int nIdConnection = 0 ;
|
||||
LuaCheckParam( L, 1, nIdConnection) ;
|
||||
string sChannel ;
|
||||
LuaCheckParam( L, 1, sChannel) ;
|
||||
LuaCheckParam( L, 2, sChannel) ;
|
||||
string sMessage ;
|
||||
LuaCheckParam( L, 2, sMessage) ;
|
||||
LuaCheckParam( L, 3, sMessage) ;
|
||||
LuaClearStack( L) ;
|
||||
// Pubblico il messaggio sul canale
|
||||
bool bOk = ExeRedisAsyncPublish( sChannel, sMessage) ;
|
||||
bool bOk = ExeRedisAsyncPublish( nIdConnection, sChannel, sMessage) ;
|
||||
// Restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
@@ -130,12 +144,14 @@ LuaRedisAsyncPublish( lua_State* L)
|
||||
static int
|
||||
LuaRedisAsyncSubscribe( lua_State* L)
|
||||
{
|
||||
// 1 parametro : sChannel
|
||||
// 2 parametri : nIdConnection, sChannel
|
||||
int nIdConnection = 0 ;
|
||||
LuaCheckParam( L, 1, nIdConnection) ;
|
||||
string sChannel ;
|
||||
LuaCheckParam( L, 1, sChannel) ;
|
||||
LuaCheckParam( L, 2, sChannel) ;
|
||||
LuaClearStack( L) ;
|
||||
// Iscrizione al canale
|
||||
bool bOk = ExeRedisAsyncSubscribe( sChannel) ;
|
||||
bool bOk = ExeRedisAsyncSubscribe( nIdConnection, sChannel) ;
|
||||
// Restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
@@ -145,12 +161,14 @@ LuaRedisAsyncSubscribe( lua_State* L)
|
||||
static int
|
||||
LuaRedisAsyncUnsubscribe( lua_State* L)
|
||||
{
|
||||
// 1 parametro : sChannel
|
||||
// 2 parametri : nIdConnection, sChannel
|
||||
int nIdConnection = 0 ;
|
||||
LuaCheckParam( L, 1, nIdConnection) ;
|
||||
string sChannel ;
|
||||
LuaCheckParam( L, 1, sChannel) ;
|
||||
LuaCheckParam( L, 2, sChannel) ;
|
||||
LuaClearStack( L) ;
|
||||
// Disiscrizione
|
||||
bool bOk = ExeRedisAsyncUnsubscribe( sChannel) ;
|
||||
bool bOk = ExeRedisAsyncUnsubscribe( nIdConnection, sChannel) ;
|
||||
// Restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
@@ -160,15 +178,17 @@ LuaRedisAsyncUnsubscribe( lua_State* L)
|
||||
static int
|
||||
LuaRedisAsyncSubscribeOneMessage( lua_State* L)
|
||||
{
|
||||
// 2 parametri : sChannel, dMaxTimeOut
|
||||
// 3 parametri : nIdConnection, sChannel, dMaxTimeOut
|
||||
int nIdConnection = 0 ;
|
||||
LuaCheckParam( L, 1, nIdConnection) ;
|
||||
string sChannel ;
|
||||
LuaCheckParam( L, 1, sChannel) ;
|
||||
LuaCheckParam( L, 2, sChannel) ;
|
||||
double dMaxTimeOut = 0. ;
|
||||
LuaCheckParam( L, 2, dMaxTimeOut) ;
|
||||
LuaCheckParam( L, 3, dMaxTimeOut) ;
|
||||
LuaClearStack( L) ;
|
||||
// Disiscrizione
|
||||
// Eseguo funzione speciale di iscrizione - attesa messaggio - disiscrizione
|
||||
string sMessage ;
|
||||
bool bOk = ExeRedisAsyncSubscribeOneMessage( sChannel, dMaxTimeOut, sMessage) ;
|
||||
bool bOk = ExeRedisAsyncSubscribeOneMessage( nIdConnection, sChannel, dMaxTimeOut, sMessage) ;
|
||||
// Restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
LuaSetParam( L, sMessage) ;
|
||||
|
||||
Reference in New Issue
Block a user