@@ -0,0 +1,1475 @@
+# -*- coding: utf-8 -*-%0A%0Aimport redis%0A%0A%0Aclass RedisDevice(object):%0A    def __init__(self, host='localhost', port=6379, timeout=0.1):%0A        self.host = host%0A        self.port = port%0A        self.timeout = timeout%0A        # privates vars%0A        self._r = redis.Redis(host=self.host, port=self.port, socket_timeout=self.timeout)%0A%0A    @property%0A    def connected(self):%0A        try:%0A            return self._r.ping()%0A        except redis.RedisError:%0A            return False%0A%0A    # tag_add, get, err and set are mandatory function to be a valid tag source%0A    def tag_add(self, tag):%0A        # check type%0A        if not any(tag.ref%5B'type'%5D in s for s in ('bool', 'int', 'float', 'str')):%0A            raise ValueError(%0A                'Wrong tag type %25s for Redis host %25s' %25 (tag.ref%5B'type'%5D, self.host))%0A%0A    def get(self, ref):%0A        try:%0A            # read%0A            value = self._r.get(ref%5B'key'%5D)%0A            # cast%0A            if ref%5B'type'%5D == 'bool':%0A                return bool(value)%0A            elif ref%5B'type'%5D == 'int':%0A                return int(value)%0A            elif ref%5B'type'%5D == 'float':%0A                return float(value)%0A            elif ref%5B'type'%5D == 'str':%0A                return str(value)%0A        except redis.RedisError:%0A            return None%0A%0A    def err(self, ref):%0A        try:%0A            return self._r.get(ref%5B'key'%5D) is None%0A        except redis.RedisError:%0A            return True%0A%0A    def set(self, value, ref):%0A        return False%0A

add experimental Redis DS