diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2012-11-27 22:04:59 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2012-12-03 01:39:10 +0900 |
| commit | f314719618d181036ceebcf45338ab76559daf55 (patch) | |
| tree | f85677a7afad929a7cf320ff93ec4265cda0dc6a /test/TestUtil.cc | |
| parent | 8ac433a8e9ab8bddd96c62db4bbeac3adce2b3ba (diff) | |
Added --disk-cache option
This option enables disk cache. If SIZE is 0, the disk cache is
disabled. This feature caches the downloaded data in memory, which
grows to at most SIZE bytes. The cache storage is created for aria2
instance and shared by all downloads. The one advantage of the disk
cache is reduce the disk seek time because the data is written in
larger unit and it is reordered by the offset of the file. If the
underlying file is heavily fragmented it is not the case.
Diffstat (limited to 'test/TestUtil.cc')
| -rw-r--r-- | test/TestUtil.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/TestUtil.cc b/test/TestUtil.cc index 6dd5d811..62424c6f 100644 --- a/test/TestUtil.cc +++ b/test/TestUtil.cc @@ -91,4 +91,18 @@ std::string fileHexDigest } #endif // ENABLE_MESSAGE_DIGEST +WrDiskCacheEntry::DataCell* createDataCell(int64_t goff, + const char* data, + size_t offset) +{ + WrDiskCacheEntry::DataCell* cell = new WrDiskCacheEntry::DataCell(); + cell->goff = goff; + size_t len = strlen(data); + cell->data = new unsigned char[len]; + memcpy(cell->data, data, len); + cell->offset = offset; + cell->len = len; + return cell; +} + } // namespace aria2 |
