---
name: "ACE_Filecache_Handle"
section: "3"
platform: "linux"
package: "libace-doc"
version: "5.0.7-4"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/ACE_Filecache_Handle"
---

# ACE\_Filecache\_Handle(3)

Abstraction over a real file. This is meant to be the entry point into the Cached Virtual Filesystem.

## NAME

ACE\_Filecache\_Handle -  Abstraction over a real file.  This is meant to be the entry point into the Cached Virtual Filesystem.

## SYNOPSIS

```
#include <ace/Filecache.h>
class ACE_Filecache_Handle
{
  public:
    ACE_Filecache_Handle (
        const char *filename,
        ACE_Filecache_Flag mapit = ACE_MAPIT
        );
    ACE_Filecache_Handle (
        const char *filename,
        int size,
        ACE_Filecache_Flag mapit = ACE_MAPIT
        );
    ~ACE_Filecache_Handle (void);
    void *address (void) const;
    ACE_HANDLE handle (void) const;
    int error (void) const;
    size_t size (void) const;
        enum{ ACE_SUCCESS = 0,
        ACE_ACCESS_FAILED,
        ACE_OPEN_FAILED,
        ACE_COPY_FAILED,
        ACE_STAT_FAILED,
        ACE_MEMMAP_FAILED,
        ACE_WRITE_FAILED };

  protected:
    ACE_Filecache_Handle (void);
    void init (void);
  private:
    ACE_Filecache_Object *file_;
    ACE_HANDLE handle_;
    int mapit_;
};
```

## DESCRIPTION

This is a cached filesystem implementation based loosely on the implementation of JAWS\_File.  The interfaces will be nearly the same.  The under-the-hood implementation should hopefully be a much faster thing.

These will be given their own implementations later. For now, we borrow the implementation provided by JAWS.

On creation, the cache is checked, and reference count is incremented.  On destruction, reference count is decremented.  If the reference count is 0, the file is removed from the cache.

    E.g. 1,\
       {\
         ACE\_Filecache\_Handle foo("foo.html");\
         this-peer ().send (foo.address (), foo.size ());\
       }

    E.g. 2,\
       {\
         ACE\_Filecache\_Handle foo("foo.html");\
         io-transmitfile (foo.handle (), this-peer ().handle ());\
       }

    E.g. 3,\
       {\
         ACE\_Filecache\_Handle foo("foo.html", content\_length);\
         this-peer ().recv (foo.address (), content\_length);\
       }

TODO:

## These come from ACE\_Filecache\_Object, which is an internal class.

## AUTHOR

James Hu

## LIBRARY

ace
