Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libdap-server-core
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
cellframe
libdap-server-core
Commits
2d5e4176
Commit
2d5e4176
authored
5 years ago
by
Dmitriy A. Gerasimov
Browse files
Options
Downloads
Patches
Plain Diff
[-] memcached files
parent
0da90550
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/dap_memcached.h
+0
-0
0 additions, 0 deletions
include/dap_memcached.h
src/dap_memcached.c
+0
-81
0 additions, 81 deletions
src/dap_memcached.c
with
0 additions
and
81 deletions
include/dap_memcached.h
deleted
100644 → 0
+
0
−
0
View file @
0da90550
This diff is collapsed.
Click to expand it.
src/dap_memcached.c
deleted
100755 → 0
+
0
−
81
View file @
0da90550
#ifdef _WIN32
#include
<winsock2.h>
#include
<windows.h>
#include
<mswsock.h>
#include
<ws2tcpip.h>
#include
<io.h>
#include
<pthread.h>
#endif
#include
"dap_memcached.h"
#include
<libmemcached/memcached.h>
#define LOG_TAG "dap_memcached"
static
memcached_st
*
_memc
;
static
bool
_is_module_enable
=
false
;
int
dap_memcached_init
(
const
char
*
server_host
,
uint16_t
port
)
{
memcached_return
rc
;
memcached_server_st
*
servers
=
NULL
;
char
*
test_key
=
"test_key"
;
char
*
test_value
=
"test_value"
;
_memc
=
memcached_create
(
NULL
);
servers
=
memcached_server_list_append
(
servers
,
server_host
,
port
,
&
rc
);
rc
=
memcached_server_push
(
_memc
,
servers
);
if
(
rc
!=
MEMCACHED_SUCCESS
)
{
log_it
(
L_ERROR
,
"Couldn't add server: %s"
,
memcached_strerror
(
_memc
,
rc
));
return
-
1
;
}
if
(
dap_memcache_put
(
test_key
,
test_value
,
strlen
(
test_value
),
0
)
!=
true
)
{
return
-
2
;
}
_is_module_enable
=
true
;
return
0
;
}
bool
dap_memcache_is_enable
()
{
return
_is_module_enable
;
}
bool
dap_memcache_put
(
const
char
*
key
,
void
*
value
,
size_t
value_size
,
time_t
expiration
)
{
memcached_return
rc
;
rc
=
memcached_set
(
_memc
,
key
,
strlen
(
key
),
value
,
value_size
,
expiration
,
(
uint32_t
)
0
);
if
(
rc
!=
MEMCACHED_SUCCESS
)
{
log_it
(
L_ERROR
,
"%s"
,
memcached_strerror
(
_memc
,
rc
));
return
false
;
}
return
true
;
}
bool
dap_memcache_get
(
const
char
*
key
,
size_t
*
value_size
,
void
**
result
)
{
memcached_return
rc
;
*
result
=
memcached_get
(
_memc
,
key
,
strlen
(
key
),
value_size
,
NULL
,
&
rc
);
return
rc
==
MEMCACHED_SUCCESS
;
}
bool
dap_memcache_delete
(
const
char
*
key
)
{
return
memcached_delete
(
_memc
,
key
,
strlen
(
key
),
0
)
==
MEMCACHED_SUCCESS
;
}
/**
* @brief dap_memcached_deinit
*/
void
dap_memcached_deinit
()
{
_is_module_enable
=
false
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment