Thread safe cache access API.

Add a mutex on database access
API with direct cache access is deprecated

+fix memory leaks in tests
Status Job ID Name Coverage
  External
passed jenkins(Centos7)

00:02:52

passed jenkins(Debian8)

00:02:22

passed jenkins(Mac)

00:02:18

passed jenkins(Centos7)

00:01:30

passed jenkins(Centos7)

00:02:54

passed jenkins(Centos7)

00:01:30

passed jenkins(Centos7)

00:04:21

passed jenkins(Centos7)

00:01:54

passed jenkins(Centos7)

00:01:39

passed jenkins(Centos7)

00:01:48

failed jenkins(Centos7)

00:00:01

passed jenkins(Centos7)

00:04:25

passed jenkins(Centos7)

00:01:18

passed jenkins(Centos7)

00:01:18

passed jenkins(Centos7)

00:01:23

passed jenkins(Centos7)

00:01:23

passed jenkins(Centos7)

00:01:24

passed jenkins(Centos7)

00:01:25

passed jenkins(Centos7)

00:01:26

passed jenkins(Centos7)

00:01:39

passed jenkins(Centos7)

00:01:24

passed jenkins(Centos7)

00:01:18

passed jenkins(Centos7)

00:01:29

passed jenkins(Centos7)

00:01:30

passed jenkins(Centos7)

00:01:31

passed jenkins(Centos7)

00:01:24

passed jenkins(Centos7)

00:01:31

passed jenkins(Centos7)

00:01:01

passed jenkins(Centos7)

00:01:31

passed jenkins(Centos7)

00:01:36

passed jenkins(Centos7)

00:01:30

passed jenkins(Centos7)

00:03:18

passed jenkins(Centos7)

00:01:24

passed jenkins(Debian8)

00:01:21

passed jenkins(Debian8)

00:01:19

passed jenkins(Debian8)

00:01:12

passed jenkins(Debian8)

00:01:44

passed jenkins(Debian8)

00:01:32

passed jenkins(Debian8)

00:01:13

passed jenkins(Debian8)

00:01:00

passed jenkins(Debian8)

00:01:36

passed jenkins(Debian8)

00:00:59

passed jenkins(Debian8)

00:01:00

passed jenkins(Debian8)

00:01:33

passed jenkins(Debian8)

00:01:03

passed jenkins(Debian8)

00:01:19

passed jenkins(Debian8)

00:02:17

passed jenkins(Debian8)

00:01:16

passed jenkins(Mac)

00:02:20

passed jenkins(Mac)

00:01:32

passed jenkins(Mac)

00:01:21

passed jenkins(Mac)

00:00:49

passed jenkins(Mac)

00:00:57

passed jenkins(Mac)

00:01:45

passed jenkins(Mac)

00:01:38

passed jenkins(Mac)

00:01:21

passed jenkins(Mac)

00:01:46

passed jenkins(Mac)

00:02:29

passed jenkins(Mac)

00:00:51

passed jenkins(Mac)

00:03:05

passed jenkins(Mac)

00:02:34

passed jenkins(Mac)

00:01:11

passed jenkins(Mac)

00:02:09