Register a set of cache operations.

    https://github.com/thom311/libnl/blob/libnl3_2_25/lib/cache_mngt.c#L252

    Called by users of caches to announce the availability of a certain cache type.

    Positional arguments:
    ops -- cache operations (nl_cache_ops class instance).

    Returns:
    0 on success or a negative error code.

def nl_cache_mngt_register(ops):
    """Register a set of cache operations.

    https://github.com/thom311/libnl/blob/libnl3_2_25/lib/cache_mngt.c#L252

    Called by users of caches to announce the availability of a certain cache type.

    Positional arguments:
    ops -- cache operations (nl_cache_ops class instance).

    Returns:
    0 on success or a negative error code.
    """
    global cache_ops

    if not ops.co_name or not ops.co_obj_ops:
        return -NLE_INVAL

    with cache_ops_lock:
        if _nl_cache_ops_lookup(ops.co_name):
            return -NLE_EXIST
        ops.co_refcnt = 0
        ops.co_next = cache_ops
        cache_ops = ops

    _LOGGER.debug('Registered cache operations {0}'.format(ops.co_name))
    return 0